Skip to content

[Backend] Implement quotes api #2

Description

@justwickedcode

Overview

Set up a basic REST API for managing quotes from movies, books, shows, and other sources.
You can freely choose the framework.

Suggestions:

ORM Suggestion:

  • Drizzle ✔️
    • I don't personally don't like the alternative, Prisma. Drizzle is a bit more verbose, but way more type safe and performant.

Endpoints

  • GET /quotes — return all quotes
  • GET /quotes?type=movie|book|show|other — filter by type
  • GET /quotes/:id — return a single quote
  • POST /quotes — create a quote
  • DELETE /quotes/:id — delete a quote

Schema

{
  id: number              // required, auto-generated by the system
  text: string            // required, the quote content

  source: string          // required, the work the quote comes from (book, movie, speech, etc.)
  attributedTo?: string   // optional, person credited for the quote (author)

  type: string           // required, type of source (movie, book, tv, speech, podcast, game, etc.)

  character?: string      // optional, character who said the quote if different from attributedTo 
                                  // (e.g. attributedTo = author, character = book character)

  createdAt: Date         // required, automatically set when the quote is created
}

e.g.

{
  "id":  1234,
  "text": "You do not rise to the level of your goals. You fall to the level of your systems.",
  "source": "Atomic Habits",
  "attributedTo": "James Clear",
  "type": "book",
  "createdAt": "2026-03-09T20:00:00Z"
}
{
  "id": 5678,
  "text": "Why so serious?",
  "source": "The Dark Knight",
  "attributedTo": "Christopher Nolan",
  "type": "movie",
  "character": "The Joker",
  "createdAt": "2026-03-09T20:01:00Z"
}

If you come with something better, go for it.

Acceptance criteria

  • Returns proper HTTP status codes (200, 201, 404, 400)
  • Data persists to the database
    • Use the DB of your choice (MySQL, Postgresql etc). Careful to port conflict between Docker and local DB.
    • Use Docker to containerize the DB. Also look into:
      • docker-compose
      • Dockerfile
  • Filtering by type works correctly, via query params.
  • Use a .env file to store your secrets. Also applicable for the docker-compose. Don't hardcode your credentials there. Also DON'T COMMIT THE .env file. You can add a .env.dev where you put some example data, so I know what env vars you're using if I want to work on your code. Example
TOKEN=blaplu
DB_NAME=postgres
DB_USER=postgres
DB_PASSWORF=postgres

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions