Skip to content

TomDoesTech/rest-api-for-scale

Repository files navigation

Build a REST API like a senior developer

Need help?

The best place to get help is on Discord or X.

Discord: https://discord.gg/4ae2Esm6P7 X: https://x.com/tomdoes_tech

What you will learn

  • Basic Principals of REST APIs
  • How to structure your applications
  • How to test REST APIs
  • How to use Docker for local development
  • How to use Drizzle for database interactions
  • How to use JSON Schema for API design
  • Basic TypeScript
  • How to capture and visualise metrics

Modules

User

  • Functional style
  • json-schema

Job

  • Object-oriented
  • Dependency injection
  • json-schema

Job application

  • Object-oriented
  • Dependency injection
  • Zod schema

Features

  • Authentication
  • User management
  • Job management
  • Metrics

Technology

  • Node.js
  • Fastify
  • Drizzle
  • Postgres
  • TypeScript
  • Pino
  • Prometheus
  • Grafana

What you'll need

  • A code editor - VSCode/Cursor
  • A HTTP client - Postman
  • Node.js installed
  • Docker installed (Optional) or a Postgres instance
  • SQL client - TablePlus (Optional)

Options for Postgres

Part 1 - Design

  • Database design
  • API design

Part 2 - Setup Docker (Optional)

  • Postgres
  • API
  • Dozzle (Logs)

Part 3 - Project setup

  • Install dependencies
  • Install dev dependencies
  • Initalise project
  • Setup database
  • Setup logging
  • Configure server

Part 4 - User module

  • Register user
  • Login
  • Get user
  • Testing

Part 5 - Job module

  • Create job
  • Get job
  • Update job
  • Delete job
  • Testing

Part 6 - Job application

  • Create job application
  • Get job applications for a job
  • Update job application status
  • Delete job application
  • Testing

Part 7 - Metrics

  • Setup Prometheus
  • Capture default metrics
  • Add a histogram for all requests
  • Add a custom metric for database calls
  • Visualise metrics with Grafana

Challenges

  1. Verify the user's account via email
  2. Add an OAuth flow with an identity provider like Google or GitHub
  3. Add multi-tenancy

Need help?

Discord: https://discord.gg/4ae2Esm6P7 Twitter: https://twitter.com/tomdoes_tech Bluesky: https://tomdoestech.bsky.social