An open API service indexing awesome lists of open source software.

https://github.com/murtaza99dev/task-tracker

A secure and scalable Task Tracker API built with TypeScript, Express, PostgreSQL, and Drizzle ORM.
https://github.com/murtaza99dev/task-tracker

drizzle-orm jwt postgresql reactjs tailwindcss tasktracker typescript zod

Last synced: 17 days ago
JSON representation

A secure and scalable Task Tracker API built with TypeScript, Express, PostgreSQL, and Drizzle ORM.

Awesome Lists containing this project

README

          

# ๐Ÿ“Œ Task Tracker

A full-featured **Task Tracker backend** built using **Node.js**, **TypeScript**, **Express**, **PostgreSQL**, and **Drizzle ORM**. The application supports user registration, authentication using JWT, and complete CRUD functionality for managing tasks.

---

## ๐Ÿš€ Features

- ๐Ÿ” User Authentication (Register/Login with JWT)
- ๐Ÿ›ก๏ธ Middleware-based route protection
- ๐Ÿ“‹ Task management (Create, Read, Update, Delete)
- ๐ŸŒฑ Environment variable configuration with `dotenv`
- ๐Ÿงพ Type-safe schema with Drizzle ORM
- ๐Ÿงช Input validation using Zod
- โšก TypeScript + tsx/ts-node-dev for smooth dev experience

---

## ๐Ÿงฐ Tech Stack

- **Node.js**
- **Express.js**
- **TypeScript**
- **PostgreSQL**
- **Drizzle ORM**
- **JWT (JSON Web Tokens)**
- **Zod**
- **dotenv**
- **tsx** / **ts-node-dev**

---

## ๐Ÿ“ Project Structure

```
task-tracker/
โ”œโ”€โ”€ drizzle.config.ts
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ .env
โ”œโ”€โ”€ src/
โ”‚ โ”œโ”€โ”€ index.ts
โ”‚ โ”œโ”€โ”€ db.ts
โ”‚ โ”œโ”€โ”€ schema/
โ”‚ โ”œโ”€โ”€ routes/
โ”‚ โ”œโ”€โ”€ middleware/
โ”‚ โ””โ”€โ”€ utils/
```

---

## โš™๏ธ Setup Instructions

### 1๏ธโƒฃ Clone the Repository

```bash
git clone https://github.com/Murtaza99dev/task-tracker.git
cd task-tracker/backend
yarn install
```

### 2๏ธโƒฃ Create .env File

```
PORT=5000
JWT_SECRET=your_jwt_secret_key
DB_HOST=localhost
DB_PORT=5432
DB_USER=your_postgres_user
DB_PASSWORD=your_postgres_password
DB_NAME=task_db
DATABASE_URL=postgresql://your_postgres_user:your_postgres_password@localhost:5432/task_db
```

### 3๏ธโƒฃ Run the Project

```bash
yarn dev
```

The server should now be running at: [http://localhost:5000](http://localhost:5000)

---

## ๐Ÿงช API Endpoints

### ๐Ÿ” Auth Routes

| Method | Endpoint | Description |
|--------|----------------|-----------------------|
| POST | /api/register | Register new user |
| POST | /api/login | Login and get JWT |

### โœ… Task Routes (Protected)

| Method | Endpoint | Description |
|--------|-----------------|---------------------|
| GET | /api/tasks | Get all tasks |
| POST | /api/tasks | Create new task |
| PUT | /api/tasks/:id | Update task |
| DELETE | /api/tasks/:id | Delete task |

> **Note:** All `/api/tasks` endpoints require a JWT token in the request header:
>
> ```
> Authorization: Bearer
> ```

---

## ๐Ÿงฐ Drizzle ORM Commands

Run after creating or modifying your schema in `src/schema`.

**Push Schema to DB**
```bash
npx drizzle-kit push
```

**Generate SQL from Schema**
```bash
npx drizzle-kit generate
```

---

## ๐Ÿง‘โ€๐Ÿ’ป Development Tools

Start server in watch mode:

```bash
yarn dev
```

**Drizzle ORM setup config (`drizzle.config.ts`):**
```ts
import { defineConfig } from "drizzle-kit";
import * as dotenv from "dotenv";
dotenv.config();

export default defineConfig({
schema: "./src/schema",
out: "./drizzle",
driver: "pg",
dbCredentials: {
connectionString: process.env.DATABASE_URL!,
},
});
```

---

## ๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

---

## ๐Ÿ™‹โ€โ™‚๏ธ Author

**Ghulam Murtaza**

- GitHub: [@Murtaza99dev](https://github.com/Murtaza99dev)
- Email: murtaza99.dev@gmail.com
- LinkedIn: [https://www.linkedin.com/in/im-ghulam-murtaza/](https://www.linkedin.com/in/im-ghulam-murtaza/)

---

## ๐Ÿง  Future Improvements

- ๐Ÿ“… Task due dates and prioritization
- ๐Ÿ“Š Task analytics
- ๐ŸŒ Frontend integration (React/Next.js)
- ๐Ÿง‘โ€๐Ÿคโ€๐Ÿง‘ Team/task sharing

---

Let me know if you want a separate Postman/Bruno collection JSON or frontend instructions added.