A minimalist habit tracking app built with NestJS (backend) and React + Vite (frontend) in an Turborepo monorepo, designed to help users build and maintain daily habits with a clean, intuitive interface.
This is an Turborepo monorepo containing:
- Backend (
apps/backend/
) - NestJS API with MongoDB, JWT authentication, and SWC for fast compilation - Frontend (
apps/frontend/
) - React + Vite SPA with TypeScript and Tailwind CSS
- π JWT authentication with refresh tokens
- π Habit tracking and statistics
- π§ Email notifications (Resend)
- ποΈ MongoDB with Mongoose
- π‘οΈ Input validation and security
- π OpenAPI documentation
- β‘ Fast compilation with SWC (10x faster than tsc)
- π Hot reload development with source maps
- π Dark/Light mode support
- π± Responsive, modern UI with Tailwind CSS
- π Interactive habit tracking with heatmaps
- π₯ Streak counting and statistics
- π Visual charts and progress tracking
- π΅ Audio feedback for habit completion
- β‘ Fast development with Vite
- Node.js (v20 or later)
- pnpm
- MongoDB (local or remote)
- Clone the repository:
git clone https://github.com/fberrez/minihabits.git
cd minihabits
- Install dependencies:
pnpm install
- Create a
.env
file in bothapps/backend/
andapps/frontend
directories using.env.example
# Start backend and frontend with hot reload
pnpm run dev
minihabits/
βββ apps/
β βββ backend/ # NestJS API (SWC compilation)
β β βββ src/
β β β βββ auth/ # Authentication module
β β β βββ habits/ # Habits management
β β β βββ stats/ # Statistics & analytics
β β β βββ users/ # User management
β β β βββ ...
β β βββ .swcrc # SWC compiler configuration
β β βββ Dockerfile
β βββ frontend/ # React + Vite SPA
β βββ src/
β β βββ components/
β β βββ pages/
β β βββ api/ # Generated OpenAPI client
β β βββ ...
β βββ Dockerfile
βββ bruno/ # API testing collection
βββ docker-compose.yml # Development containers
The backend uses SWC instead of the traditional TypeScript compiler or Nest CLI for significantly faster builds:
- β‘ 10x faster compilation than TypeScript compiler
- πΊοΈ Source maps enabled - errors point to TypeScript files
- π Hot reload with nodemon + concurrently
- π§ Path mapping support for absolute imports
- π¦ Turborepo integration with build caching
- π― No Nest CLI dependency - streamlined toolchain
- Compiler: SWC with custom configuration (
.swcrc
) - Path mapping: Supports absolute imports (
src/*
) - Source maps: Enabled for proper error reporting
- Hot reload: Automatic rebuild and restart on file changes
- Type checking: Runs separately via TypeScript compiler
- File change detected β SWC rebuilds instantly
- Build complete β nodemon restarts Node.js process
- Error occurs β Stack trace shows TypeScript file locations
- Repeat β Fast iteration cycle
- Hosting: VPS - OVH
- Containerization: Docker (multi-stage builds)
- Backend Compilation: SWC for fast production builds
- Reverse Proxy: Traefik
- SSL: Let's Encrypt via Traefik
- Monorepo: Turborepo for build optimization and caching
# Development with Docker Compose
docker-compose up -d
# Build production images
docker build -f apps/backend/Dockerfile -t minihabits-backend .
docker build -f apps/frontend/Dockerfile -t minihabits-frontend .
- Framework: NestJS with TypeScript
- Compiler: SWC (replacing tsc and Nest CLI)
- Database: MongoDB with Mongoose ODM
- Authentication: JWT with refresh tokens
- Validation: class-validator, class-transformer
- Email: Resend API
- Documentation: OpenAPI/Swagger
- Testing: Jest
- Development: Hot reload with nodemon + concurrently
- Framework: React 18 with TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS
- UI Components: Custom components with Radix UI
- Charts: Recharts
- HTTP Client: Generated from OpenAPI spec
- State Management: React Query (TanStack Query)
- Monorepo: Turborepo
- Package Manager: pnpm
- Containerization: Docker
- API Testing: Bruno
- Code Quality: ESLint, Prettier
- CI/CD: GitHub Actions
This project uses SWC instead of the traditional Nest CLI or TypeScript compiler:
Feature | Nest CLI | SWC |
---|---|---|
Build Speed | ~3-5s | ~0.1s |
Hot Reload | Built-in | Custom setup |
Source Maps | β | β |
Dependencies | @nestjs/cli | @swc/cli |
Configuration | nest-cli.json | .swcrc |
This project is licensed under the GNU License - see the LICENSE file for details.