Skip to content

AnalogStudiosRI/api

Repository files navigation

API

Overview

Serverless APIs for www.analogstudios.net (and friends) using arc.codes.

Local Setup

Credentials

Assumes valid AWS credentials are either exported as environment variables or you have a relevant configuration setup in ~/aws/credentials.

Additionally, the following credentials files are required to run this project for the various services and APIs exposed.

preferences.arc

For running the various APIs using the Architect sandbox.

Name Service Role
AWS_ACCESS_KEY_ID AWS Publish API
AWS_SECRET_ACCESS_KEY AWS Publish API
AWS_CLOUDFRONT_ID AWS Publish API
CONTENTFUL_ACCESS_TOKEN Contentful Events API
CONTENTFUL_SPACE Contentful Events API
CONTENTFUL_WEBHOOK_ACCESS_TOKEN Contentful Publish API
DATABASE_URL Turso All APIs except Events
DATABASE_TOKEN Turso

.env

For running Prisma Studio.

Name Service Role
DATABASE_URL Local SQLite All APIs except Events

Install

  1. Clone the repo
  2. Run npm ci
  3. Run npm run arc env
  4. Run npm start to use the local Architect sandbox for development
  5. Make a copy of .env.local and rename it to .env

To use Prisma Studio, run npm run studio

Supported APIs

Albums

Data sourced from Turso for the Album resource type. Available at /albums internally and publicly as /api/v2/albums.

Options:

  • ?id=xxx - Filter by the id of the album
  • ?artistId=xxx - Filter by the id of an artist

You can only pass one or the other

Artists

Data sourced from Turso for the Artist resource type. Available at /artists internally and publicly as /api/v2/artists.

Options:

  • ?id=xxx - Filter by the id of the artist

Events

Structured events content sourced from Contentful for the Event resource type. Available at /events internally and publicly as /api/v2/events.

Options:

  • ?id=xxx - Filter by the id of the event
  • ?tag=xxx - Filter by tags of the event

You can only pass one or the other

Posts

Data sourced from Turso for the Post resource type. Available at /posts internally and publicly as /api/v2/posts.

Options:

  • ?id=xxx - Filter by the id of a post