|
| 1 | +# Build a REST API like a senior developer |
| 2 | + |
| 3 | +## What you will learn |
| 4 | +* Basic Principals of REST APIs |
| 5 | +* How to structure your applications |
| 6 | +* How to test REST APIs |
| 7 | +* How to use Docker for local development |
| 8 | +* How to use Drizzle for database interactions |
| 9 | +* How to use JSON Schema for API design |
| 10 | +* Basic TypeScript |
| 11 | +* How to capture and visualise metrics |
| 12 | + |
| 13 | + |
| 14 | +## Modules |
| 15 | +### User |
| 16 | +* Functional style |
| 17 | +* json-schema |
| 18 | + |
| 19 | +### Job |
| 20 | +* Object-oriented |
| 21 | +* Dependency injection |
| 22 | +* json-schema |
| 23 | + |
| 24 | +## Job application |
| 25 | +* Object-oriented |
| 26 | +* Dependency injection |
| 27 | +* Zod schema |
| 28 | + |
| 29 | +## Features |
| 30 | +* Authentication |
| 31 | +* User management |
| 32 | +* Job management |
| 33 | +* Metrics |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +## Technology |
| 38 | +* Node.js |
| 39 | +* Fastify |
| 40 | +* Drizzle |
| 41 | +* Postgres |
| 42 | +* TypeScript |
| 43 | +* Pino |
| 44 | +* Prometheus |
| 45 | +* Grafana |
| 46 | + |
| 47 | +## What you'll need |
| 48 | +* A code editor - VSCode/Cursor |
| 49 | +* A HTTP client - Postman |
| 50 | +* Node.js installed |
| 51 | +* Docker installed (Optional) or a Postgres instance |
| 52 | +* SQL client - [TablePlus](https://tableplus.com) (Optional) |
| 53 | + |
| 54 | +## Options for Postgres |
| 55 | +* Docker (Recommended) |
| 56 | +* Local Postgres instance |
| 57 | +* DBngin (local) https://dbngin.com/ |
| 58 | +* Neon (Cloud) https://neon.tech/ |
| 59 | +* Supabase (Cloud) https://supabase.com/ |
| 60 | + |
| 61 | +## Part 1 - Design |
| 62 | +* Database design |
| 63 | +* API design |
| 64 | + |
| 65 | +## Part 2 - Setup Docker (Optional) |
| 66 | +* Postgres |
| 67 | +* API |
| 68 | +* Dozzle (Logs) |
| 69 | + |
| 70 | +## Part 3 - Project setup |
| 71 | +* Install dependencies |
| 72 | +* Install dev dependencies |
| 73 | +* Initalise project |
| 74 | +* Setup database |
| 75 | +* Setup logging |
| 76 | +* Configure server |
| 77 | + |
| 78 | +## Part 4 - User module |
| 79 | +* Register user |
| 80 | +* Login |
| 81 | +* Get user |
| 82 | +* Testing |
| 83 | + |
| 84 | +## Part 5 - Job module |
| 85 | +* Create job |
| 86 | +* Get job |
| 87 | +* Update job |
| 88 | +* Delete job |
| 89 | +* Testing |
| 90 | + |
| 91 | +## Part 6 - Job application |
| 92 | +* Create job application |
| 93 | +* Get job applications for a job |
| 94 | +* Update job application status |
| 95 | +* Delete job application |
| 96 | +* Testing |
| 97 | + |
| 98 | +## Part 7 - Metrics |
| 99 | +* Setup Prometheus |
| 100 | +* Capture default metrics |
| 101 | +* Add a histogram for all requests |
| 102 | +* Add a custom metric for database calls |
| 103 | +* Visualise metrics with Grafana |
| 104 | + |
| 105 | +## Challenges |
| 106 | +1. Verify the user's account via email |
| 107 | +2. Add an OAuth flow with an identity provider like Google or GitHub |
| 108 | +3. Add multi-tenancy |
| 109 | + |
| 110 | +## Need help? |
| 111 | +Discord: https://discord.gg/4ae2Esm6P7 |
| 112 | +Twitter: https://twitter.com/tomdoes_tech |
| 113 | +Bluesky: https://tomdoestech.bsky.social |
0 commit comments