A backend for a Hacker News-style community where developers share and discuss learning resources.
Stack: TypeScript · Node.js · Express 5 · SQLite · JWT
Status: Backend prototype. React screens are planned; the repository contains UI designs, not an implemented React application.
- User registration and sign-in.
- Creating, listing, reading, and deleting posts.
- Creating and listing comments.
- Adding and removing likes.
- SQLite persistence through a datastore interface and SQL migrations.
These are source-level capabilities. Automated test coverage and deployment validation are still needed.
Express routes (index.ts)
|
Handlers
|
Datastore interface
|
SQLite + migrations
The current implementation is one Express application. Product ideas in the PRD describe future work.
Use a current Node.js LTS release and npm.
git clone https://github.com/MONOCODE-V/codersquare.git
cd codersquare
npm installCreate a .env file in the repository root:
PORT=3000
JWT_SECRET=replace-with-a-long-random-local-secretnpm startThe default URL is http://localhost:3000. Startup initializes SQLite and applies migrations under server/dataStore/sql/migration/. Use a disposable local database when exploring the existing migration history.
| Method | Path | Authentication |
|---|---|---|
| POST | /v1/users |
Public registration |
| POST | /v1/users/auth |
Public sign-in |
| POST, GET | /v1/posts |
JWT middleware |
| GET, DELETE | /v1/posts/:id |
JWT middleware |
| POST, GET | /v1/comments |
JWT middleware |
| POST, DELETE | /v1/likes |
JWT middleware |
| GET | /v1/signinStatus |
JWT middleware |
See index.ts for route wiring and Handlers/api.ts for request/response types.
Handlers/: request handlers.middlewares/: authentication middleware.server/auth.ts: JWT helpers.server/dataStore/: persistence interface and implementations.- Product requirements.
- Database design.
- UI designs.
npm run buildinvokes TypeScript compilation.npm testis currently a placeholder that exits with an error.- Registration token creation, password hashing, request-body logging, authorization, and migration behavior need review before deployment.
- Implement the frontend, add end-to-end API tests, and publish a reproducible demo before treating this as a finished product.
The repository includes an MIT license; package metadata currently declares ISC and needs reconciliation.