A habit tracking application that allows users to track both singular (yes/no completion) and timed habits (duration-based) in a structured format.
Built using UV, Django, and PostgreSQL.
Routine Grid helps users build consistent routines by tracking daily habits. The application supports two habit types:
- Singular habits (completed or not - e.g., "Did you meditate today?")
- Timed habits (tracked with duration values - e.g., "45 minutes of exercise")
-
User Management
- User registration and authentication with JWT
- User profile management
- Password reset functionality
-
Habit Tracking
- Create, view, update, and archive/unarchive habits
- Mark habits as completed with date-specific entries
- Add notes to habit entries
- Track time-based habits with custom values
- Filter habits by active/archived status
- Filter entries by date range and habits
-
API Documentation
- Interactive API documentation with Scalar
- Backend
- Python 3.13
- Django 5.2
- Django REST Framework
- PostgreSQL
- JWT Authentication
- drf-spectacular (Swagger/OpenAPI)
-
Clone the repository
git clone <repository-url> cd routine-grid
-
Set up a virtual environment using UV
uv venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies
uv sync
-
Create environment variables
cp .env.example .env # Edit .env with your database credentials and settings
-
Run migrations
uv run manage.py migrate
-
Create a superuser
uv run manage.py createsuperuser
-
Run the development server
uv run manage.py runserver
The following environment variables can be configured in the .env
file:
DATABASE_URL
: PostgreSQL database connection stringSECRET_KEY
: Django secret key for securityDEBUG
: Set to True for development, False in productionALLOWED_HOSTS
: Comma-separated list of allowed hostsCORS_ALLOWED_ORIGINS_ENV
: Comma-separated list of allowed CORS origins
POST /api/v1/auth/register/
: Register a new userPOST /api/v1/auth/login/
: Obtain JWT tokensPOST /api/v1/auth/refresh/
: Refresh JWT tokenPOST /api/v1/auth/password_reset/
: Initiate password reset
GET /api/v1/users/me/
: Get current user profilePUT/PATCH /api/v1/users/me/
: Update user profileDELETE /api/v1/users/me/
: Delete user account
GET /api/v1/habits/
: List user's habits (with optional archive filter)POST /api/v1/habits/
: Create a new habitGET /api/v1/habits/{id}/
: Get a specific habitPUT /api/v1/habits/{id}/
: Update a habit (full)PATCH /api/v1/habits/{id}/
: Update a habit (partial)DELETE /api/v1/habits/{id}/
: Delete a habit (hard delete)POST /api/v1/habits/{id}/archive/
: Archive a habit (soft delete)POST /api/v1/habits/{id}/unarchive/
: Unarchive a habit
GET /api/v1/entries/
: List habit entries (with filters)POST /api/v1/entries/
: Create a new habit entryGET /api/v1/entries/{id}/
: Get a specific habit entryPUT/PATCH /api/v1/entries/{id}/
: Update an entryDELETE /api/v1/entries/{id}/
: Delete an entry
/api/schema.yaml
: OpenAPI schema/
: Scalar API documentation
The project includes comprehensive tests for API endpoints:
uv run manage.py test
- Follow PEP 8 style guidelines
- Write tests for new features
- Document API endpoints
- Use Django's model validation
Heet Patel - [email protected]