Backend: Node.js+Express Database: Postgresql ORM: Drizzle Containerization: Docker+Compose Authentication: JWT Testing Tool: Postman
npm install express drizzle-orm pg jsonwebtoken bcrypt dotenv
npm i @types/node @types/express@4.x -D| Method | Endpoint | Description | Auth Required | 
|---|---|---|---|
| POST | /signup | Register a new user | ❌ | 
| POST | /login | Login and receive token | ❌ | 
| Method | Endpoint | Description | Auth Required | 
|---|---|---|---|
| POST | /shorten | Create a short URL from a long one | ✅ | 
| GET | /:shortCode | Redirect to the original URL | ❌ | 
| GET | /urls | Get all URLs created by the logged-in user | ✅ | 
| DELETE | /urls/:id | Delete a short URL (if it belongs to user) | ✅ | 
We have already established the docker-compose.yml, now if we are having the docker hub, we can run the same here on it using:
bash ``` docker compose up -d
Now after this setup, we will setup the postgres in drizzle:
bash ```
npm db:studio
In a new terminal, we will push the changes in DB using:
bash ``` npm db:push
After creating schema, we need to push the schema:
bash ```
npm db:push