📂 Typical Project Layout
Let's take a look at a typical project layout:
project/
├── class/ # Business logic classes (request-scoped)
│ ├── Payment.js
│ └── User.js
├── controller/ # HTTP request handlers
│ ├── api/ # API endpoint controllers
│ │ ├── auth.js
│ │ └── users.js
│ └── page/ # HTML page controllers
│ ├── about.js
│ └── home.js
├── hook/ # Framework lifecycle hooks
│ └── auth.js # beforeLogin, login, loginFailed
├── lang/ # Translation files (en.json, tr.json, pt-BR.json, ...); commit these
├── middleware/ # Route middleware functions
│ └── auth.js
├── public/ # Static assets (directly accessible)
│ └── assets/
│ ├── css/
│ │ └── app.css # Auto-generated by Tailwind
│ ├── img/
│ └── js/
├── route/ # Route definitions (subdomain-based)
│ ├── api.js # Routes for api.example.com
│ └── www.js # Routes for www.example.com
├── storage/ # Runtime data (logs, cache, uploads); git-ignored
│ └── .cache/
├── view/ # HTML templates
│ ├── content/
│ ├── css/ # (Optional) Custom Tailwind entry points
│ ├── footer/
│ ├── header/
│ └── skeleton/
├── .env # Environment variables (secrets, API keys)
├── odac.json # App configuration
└── package.json # Project metadata & npm scripts
📁 Directory Breakdown
| Directory | Purpose |
|---|---|
class/ |
Request-scoped service classes for business logic |
controller/ |
HTTP handlers that process requests and return responses |
hook/ |
Framework lifecycle hooks; auth.js runs on every sign-in (see Login Hooks) |
middleware/ |
Functions that run before controllers (auth, logging, etc.) |
route/ |
Route definitions, one file per subdomain |
view/ |
HTML templates and partials |
public/ |
Static files served directly to browsers |
lang/ |
Translation files, one JSON file per language; version-controlled (see Translations; lang.path moves it) |
storage/ |
Runtime data (cache, logs, file uploads); git-ignored |
Serving public/
- Files are revalidated on every visit (
Cache-Control: public, max-age=0, must-revalidatewithETagandLast-Modified), so an unchanged file costs a304and a deploy reaches returning visitors immediately. - Add a
vquery parameter to cache a URL for a year:<link href="/assets/css/app.css?v=2026-11-12">. Change the value whenever the file changes. - Byte ranges (
Range: bytes=…) are supported for video and audio seeking. - Dotfiles and dot-directories (
.env,.git/) are never served;.well-known/is the exception. - Files with an unknown extension are sent as
application/octet-stream.
CLI Commands
Your package.json includes scripts to manage your project lifecycle:
# STAGE 1: DEVELOPMENT
# Starts dev server with hot-reload & automatic Tailwind CSS
npm run dev
# STAGE 2: BUILD
# Compiles and optimizes assets (CSS) for production
npm run build
# STAGE 3: PRODUCTION
# Starts the optimized server
npm start
Note: For production websites with DNS and SSL, use odac web create to register with Odac server.
Following this structure helps keep your code's responsibilities separate. Your routing logic lives in one place, your app logic in another, and your presentation files in a third. It's a recipe for success!