Dopamine Lock Web - A discipline web app that helps users eliminate distractions, complete focus missions, and build consistency.
A discipline operating system for focused work, distraction control, digital consumption awareness, and long-term consistency.
Discipline is built by resistance.
Dopamine Lock Web is a full-stack behavioral discipline platform that turns intention into enforced action: pairing structured focus missions with real-time distraction blocking, short-form content control, and long-term progress tracking.
The Dopamine Lock entry experience introduces the platform's discipline-first philosophy.
Dopamine Lock Web is a full-stack discipline operating system designed to help users reduce digital distractions, complete focus missions, control short-form content consumption, maintain streaks, measure discipline, and connect focused daily work with long-term personal goals.
It combines several disciplines that are normally shipped as separate, disconnected tools:
The platform is not a marketing product with speculative claims; every capability described in this document is backed by a working backend module, database model, or frontend page in this repository.
Modern attention is engineered against sustained focus:
Dopamine Lock Web closes the gap between planning and execution by making focus an enforced, tracked, and scored activity rather than a self-reported intention.
Create Mission
↓
Configure Focus Rules
↓
Start Active Session
↓
Block Distractions
↓
Track Focus and Consumption
↓
Complete Mission
↓
Update Streak and Discipline Score
↓
Review Analytics
↓
Progress Toward Goals
Each stage writes to the same backend, so a single focus session simultaneously updates streaks, discipline score events, session history, and long-term goal progress.
| Capability | Task Managers | Pomodoro Timers | Website Blockers | Habit Trackers | Dopamine Lock Web |
|---|---|---|---|---|---|
| Mission-based focus sessions | ✕ | Partial | ✕ | ✕ | ✅ |
| Website / app blocking | ✕ | ✕ | ✅ | ✕ | ✅ |
| Reels / Shorts consumption limits | ✕ | ✕ | ✕ | ✕ | ✅ |
| Discipline score | ✕ | ✕ | ✕ | Partial | ✅ |
| Streak calendar | ✕ | ✕ | ✕ | ✅ | ✅ |
| Identity engine | ✕ | ✕ | ✕ | ✕ | ✅ |
| Weekly / monthly reviews | ✕ | ✕ | ✕ | Partial | ✅ |
| Browser-level enforcement | ✕ | ✕ | ✅ | ✕ | ✅ (API ready, client in development) |
Dopamine Lock Web does not compete on any single dimension: it combines mission execution, distraction blocking, and consumption discipline into one behavioral system with a single source of truth.
Missions are the core unit of work. Each mission can define a duration, blocking rules, and a completion condition; an active session enforces those rules until the mission ends or is abandoned, and every session is recorded to history.
Mission Center |
Active Mission Session |
Block Manager |
Session History |
Short-form content (Reels and Shorts) is tracked per platform against configurable daily limits, with a running consumption score and trend history distinct from focus-session metrics.
Consumption Control
Every completed or failed session generates discipline score events, which feed a streak calendar, an achievement system, and an identity engine that reflects a user’s behavioral trajectory over time.
Streak Calendar |
Discipline Score |
Achievements |
Identity Engine |
A dashboard aggregation service pulls focus, consumption, streak, and score data into a single overview, with dedicated analytics, goal tracking, and weekly/monthly review pages for deeper reflection.
Dashboard
Analytics |
Goals Hub |
Weekly Review |
Monthly Review |
Standard email/password authentication is backed by JWT sessions, bcrypt hashing, a rate-limited password-recovery flow, avatar uploads, and local HTTPS for realistic development.
Login |
Registration |
Password Recovery |
Local HTTPS |
Settings |
Profile |
A dedicated backend API (/api/extension) already exposes sync state, mission state, effective blocking rules, and consumption state for a companion browser extension, and records block attempts and consumption events reported by it. The frontend includes a Browser Extension page that surfaces this sync status to the user.
ExtensionStatus model)
Browser Extension Sync Status
Status: The extension-facing API and its data model are implemented and covered by a dedicated database migration. The Manifest V3 browser extension client itself is planned future work and is not yet part of this repository: see Current Status.
Register or Login
↓
Create a Mission
↓
Choose Duration and Blocking Rules
↓
Start the Active Mission
↓
Browser Extension Enforces Restrictions
↓
Focus and Consumption Events Are Recorded
↓
Streak, Discipline Score, Analytics and Identity Update
↓
Weekly and Monthly Reviews Summarize Progress
The backend is the single source of truth for mission state, blocking rules, and consumption limits. The browser extension is the enforcement layer at the edge: it reads effective rules from /api/extension and reports block attempts and consumption events back to the same backend.
React / Vite Frontend (frontend/)
↓ HTTPS / fetch
Express REST API (backend/src/app.js)
↓
Controllers → Services (aggregation & business logic)
↓
Prisma ORM (backend/prisma/schema.prisma)
↓
PostgreSQL
Companion Browser Extension (planned)
↕ /api/extension
Mission, Block Manager and Consumption Services
fetch via a shared API client.authMiddleware on protected routes.emailService.backend/uploads/avatars.| Module | Responsibility |
|---|---|
| Authentication | Registration, login, JWT issuance, session identity (/api/auth) |
| Password Reset | Rate-limited forgot/reset password flow with emailed, single-use tokens |
| User Profile | Profile data and avatar upload (/api/profile) |
| Missions | Mission creation and lifecycle (/api/missions) |
| Mission Session | Active session start/pause/complete tracking (/api/mission-session) |
| Block Manager | Custom and preset website block rules (/api/block-manager) |
| Session History | Historical record of completed/failed sessions (/api/session-history) |
| Streak | Daily consistency tracking (/api/streak) |
| Discipline Score | Score events and snapshots derived from session outcomes (/api/discipline-score) |
| Consumption Control | Reels/Shorts logging and limits (/api/consumption) |
| Analytics | Focus, mission, and consumption analytics (/api/analytics) |
| Goals | Long-term goals linked to missions (/api/goals) |
| Achievements | Unlockable achievements by category and rarity (/api/achievements) |
| Identity | Rank and identity progression (/api/identity) |
| Weekly & Monthly Review | Period-based performance summaries (/api/reviews) |
| Dashboard Aggregation | Combined overview across all modules (/api/dashboard) |
| Browser Extension API | Sync, rules, mission state, and event ingestion for the extension (/api/extension) |
Dopamine_lock_web/
├── backend/
│ ├── prisma/
│ │ ├── schema.prisma
│ │ ├── seed.js
│ │ └── migrations/
│ ├── src/
│ │ ├── app.js
│ │ ├── config/prisma.js
│ │ ├── controllers/
│ │ ├── middleware/
│ │ ├── routes/
│ │ └── services/
│ ├── __tests__/
│ ├── server.js
│ └── .env.example
├── frontend/
│ ├── src/
│ │ ├── pages/
│ │ ├── components/
│ │ ├── context/
│ │ ├── hooks/
│ │ ├── services/
│ │ └── routes/ProtectedRoute.jsx
│ └── vite.config.js
├── Docs/
│ └── screenshots/
└── README.md
git clone git@github.com:AayuAmor/Dopamine_lock_web.git
cd Dopamine_lock_web
cd backend
npm install
cp .env.example .env
Edit .env with your PostgreSQL credentials and secrets (see Environment Variables), then:
npm run prisma:migrate # apply database migrations
npm run prisma:generate # generate the Prisma client
npm run prisma:seed # seed achievements (optional but recommended)
npm run dev # start the backend with nodemon
The backend also exposes npm start for a non-watch run and npm run prisma:studio to browse data with Prisma Studio.
cd frontend
npm install
npm run dev
Set VITE_API_BASE_URL in frontend/.env (see below); it defaults to https://localhost:5000/api if unset.
Both the frontend and backend default to HTTPS (HTTPS_ENABLED=true) and expect certificates at certs/localhost-key.pem and certs/localhost-cert.pem inside each app folder.
mkcert -install
mkdir -p frontend/certs backend/certs
mkcert -key-file frontend/certs/localhost-key.pem -cert-file frontend/certs/localhost-cert.pem localhost 127.0.0.1 ::1
mkcert -key-file backend/certs/localhost-key.pem -cert-file backend/certs/localhost-cert.pem localhost 127.0.0.1 ::1
https://localhost:5173https://localhost:5000For plain HTTP development, set HTTPS_ENABLED=false in both .env files and use matching http:// origins to avoid mixed-content errors.
The extension client itself is not yet part of this repository (see Current Status). Once available, the intended workflow is:
chrome://extensions)./api/extension base URL with an authenticated bearer token.Never commit real values for these: only the placeholders below.
backend/.env)PORT=5000
CLIENT_ORIGINS=https://localhost:5173,https://127.0.0.1:5173
DB_NAME=DopamineLock_Web
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_HOST=127.0.0.1
DB_PORT=5432
DATABASE_URL=postgresql://USER:PASSWORD@127.0.0.1:5432/DopamineLock_Web?schema=public
JWT_SECRET=replace-with-a-long-random-secret
JWT_EXPIRES_IN=7d
FRONTEND_URL=https://localhost:5173
HTTPS_ENABLED=true
SSL_KEY_PATH=certs/localhost-key.pem
SSL_CERT_PATH=certs/localhost-cert.pem
SMTP_HOST=smtp.example.com
SMTP_PORT=587
SMTP_SECURE=false
SMTP_USER=smtp-user@example.com
SMTP_PASSWORD=smtp-password
EMAIL_FROM=Dopamine Lock <no-reply@dopaminelock.app>
PASSWORD_RESET_EXPIRES_MINUTES=30
PASSWORD_RESET_RATE_LIMIT_WINDOW_MS=900000
PASSWORD_RESET_RATE_LIMIT_MAX=5
frontend/.env)VITE_API_BASE_URL=https://localhost:5000/api
HTTPS_ENABLED=true
SSL_KEY_PATH=certs/localhost-key.pem
SSL_CERT_PATH=certs/localhost-cert.pem
PostgreSQL stores all application data; Prisma manages the schema, relationships, and migrations. All user-facing data (missions, sessions, block rules, consumption logs, discipline score events, achievements, goals, identity snapshots, and review data) is scoped to an owning user.
npm run prisma:migrate # create/apply a migration
npm run prisma:generate # regenerate the Prisma client
npm run prisma:seed # seed the achievement catalog
npm run prisma:studio # inspect data visually
All routes are mounted under /api and, except for /api/health, /api/auth/register, and /api/auth/login, require an Authorization: Bearer <token> header.
| Base path | Purpose |
|---|---|
/api/auth |
Register, login, current user, forgot/reset password |
/api/profile |
Profile data and avatar upload |
/api/missions |
Mission CRUD and lifecycle |
/api/mission-session |
Active session control |
/api/block-manager |
Block rules and preset lists |
/api/session-history |
Completed/failed session records |
/api/streak |
Streak calendar data |
/api/discipline-score |
Score events and snapshots |
/api/consumption |
Reels/Shorts logs and limits |
/api/analytics |
Focus, mission, and consumption analytics |
/api/goals |
Goal creation and mission linkage |
/api/achievements |
Achievement catalog and unlocks |
/api/identity |
Identity rank and progression |
/api/reviews |
Weekly and monthly review data |
/api/dashboard |
Aggregated dashboard overview |
/api/extension |
Extension sync, rules, and event ingestion |
The backend uses Jest and Supertest for API-level testing. The current suite (backend/__tests__/authPasswordReset.test.js) covers the password-recovery flow end to end:
400500429 after the configured threshold)cd backend
npm test
Negative test cases are expected to pass: a 400/401/429 response for invalid input is the correct, verified behavior, not a failure. Test coverage for the remaining modules (missions, block manager, consumption, etc.) is part of the ongoing roadmap.
authMiddleware, validated against a live user record on every requestPASSWORD_RESET_EXPIRES_MINUTES)passwordResetRateLimit)CLIENT_ORIGINS/FRONTEND_URL, rejecting unrecognized origins.env, certs/, *.pem, and uploaded avatars are excluded from version controlWarning: Never commit
.env, SMTP credentials, database credentials, JWT secrets, uploaded avatars, or private certificate keys.
| Area | Status |
|---|---|
| Core web application (frontend + backend) | Complete |
| Mission, consumption, discipline, and identity features | Complete |
| Browser extension backend API | Complete |
| Browser extension client (Manifest V3) | Not yet implemented (planned) |
| Automated test coverage | Ongoing (password reset covered; other modules planned) |
| Production deployment | Pending |
/api/extension APIThe GitHub/DevGraph vision extends Dopamine Lock beyond time-based discipline: rewarding developers not just for time spent in focus sessions, but for producing meaningful project activity: commits, coding missions, and sustained development work.
git checkout -b feature/your-feature)This project currently has no open-source license. All rights are reserved unless stated otherwise.
AayuAmor (github.com/AayuAmor)
Built with React, Vite, Express, PostgreSQL, Prisma, and the broader open-source ecosystem these tools depend on.