How hitenvats16/onlyauth-backend works
Project type and purpose
• OnlyAuthBackend is a standalone Node.js backend service whose sole purpose is to implement OAuth2 Authorization Code Grant and secure user authentication via Scrypt password hashing.
• There is no frontend in this repo; it exposes HTTP endpoints for clients (web/mobile/native) to register, authenticate, obtain access tokens, and manage resources.
File structure
• Top‑level files
• index.js – entrypoint that bootstraps the Express server
• Dockerfile & compose.dev.yaml – containerization and local orchestration
• development.env – environment variables
• package.json – dependencies and scripts
• common/
• config.js – centralized configuration loader
• constants/ – error codes, OAuth scopes
• db/ – Prisma schema, migration scripts, and DB setup
• errors.js – common error definitions
• utils/ – logger and time utilities
• modules/
Four feature modules, each with
• router.js – Express route definitions
• controller.js – HTTP request handlers
• service.js – business logic
• (optional) middleware.js – request filtering/authorization
– user, resources, operations, dashboard
README for additional insights
• Emphasizes use of Scrypt for password hashing (high compute/memory)
• Implements OAuth Authorization Code Grant flow
Detail
• Data flow for:
• User registration & login (Scrypt hashing)
• Authorization code exchange
• Access token generation
• Protected resource access
• Migration pipeline (common/db/migrations) as a side process or note