Getting started
You do not need to know Hono or MongoDB on day one. You only need this story:
The story of one button tap
- Student taps “Submit answer” in the Flutter app.
- App sends HTTP POST to something like
https://api.example.com/api/v1/practice-pyq/.../answer - Request includes header:
Authorization: Bearer eyJhbG...(access token). index.tsreceives the request and forwards it to the right route file.auth.middleware.tschecks: “Is this token valid? Does the user exist?”- Route parses JSON body with a validator (Zod schema).
- Route calls a service (e.g. grade answer, update SRS card).
- Service reads/writes models in MongoDB.
- Route returns JSON → app shows “Correct!” or “Try again”.
Nothing magic — just a pipeline.
Folders you’ll touch most
| Folder | Baby name | Job |
|---|---|---|
src/index.ts | Front door | Wires URLs to route files |
src/routes/ | Reception desks | One desk per area (auth, users, admin, …) |
src/middleware/ | Bouncers | Auth, admin role, internal API key |
src/services/ | Chefs | Real rules and workflows |
src/models/ | Filing cabinets | Shape of each MongoDB collection |
src/validators/ | Form checkers | ”Email must look like email” |
src/config/ | Settings | .env → typed env object, DB connect |
Next pages
- Glossary — HTTP, JWT, CORS, SRS, …
- Your first request — try
/healthand auth flow - Env & secrets — what each variable is for
Last updated on