This project is a REST API backend server for a habit tracking application, that implements the core features like user auth, creating habits with tags, and completion logs.
The goal of this project was to learn Drizzle ORM while creating a habit tracking backend API.
- implement rate limiting to prevent abuse
- endpoints that return lists should support pagination via
?page=2&limit=20 - add support for getting habit stats like current streak
- TypeScript - static types for JavaScript
- PostgresSQL - database via Neon
- Node.js - JavaScript runtine for server
- Express.js - web server framework
- Drizzle ORM - database ORM
- Zod - data validations
Clone this repoository from GitHub:
git clone https://github.com/marekzelinka/habit-tracker-api/ && cd habit-tracker-apiInstall deps using pnpm:
pnpm install- Go to https://neon.new/
- Create new database in the browser and copy the
DATABASE_URL - Paste as
DATABASE_URLin your.envfile
Copying the contents of the .env.exmaple file into a new .env file and fill in the required environment variables.
Paste the copied DATABASE_URL in your new .env file.
Push the application database schema to your new database:
pnpm db:push(Optional step) Seed your database with dummy data:
pnpm db:seed