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 run prisma db push
  5. Run npm start to use the local Architect sandbox for development
  6. 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 /api/albums locally and publicly as /api/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 /api/artists locally and publicly as /api/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 /api/events locally and publicly as /api/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 /api/posts locally and publicly as /api/posts.

Options:

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

Release Management

With the appropriate AWS environment variables in place (either locally exported, in GitHub Actions, or configured through Arc / AWS), the follow workflows are available and integrated into GitHub Actions

  • npm run deploy:sandbox - Build the project and test with Arc's local sandbox
  • npm run deploy:staging - Build and deploy for staging environment (runs on PRs)
  • npm run deploy:production - Build and deploy for production environment (runs on merge into mainline)

About

Serverless API functions for www.analogstudios.net (and friends)

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors