Architectures
Minimal Architecture
A small route-first layout for prototypes and simple APIs.
Minimal architecture is the simplest StartXKit layout.
It keeps each feature in a route file and puts the request handlers directly inside that file. There are no controllers, services, repositories, interfaces, or validators.
When To Use Minimal
Use minimal when:
- You are building a prototype
- The API has only a few endpoints
- The business logic is small
- You want the least amount of structure
- You are learning how the framework works
Avoid minimal when:
- Multiple developers will work on the same API
- You expect many modules
- You need dedicated business logic or data access layers
- You want clear test boundaries around services or repositories
Structure
src/
server.ts
routes/
health.route.ts
users.route.ts
config/
shared/The exact support folders depend on your selected features. For example, config/ appears when env or CORS config is enabled.
Request Flow
Request
|
v
route file
|
v
inline handler
|
v
ResponseExample Route File
import { Router } from "express";
const router = Router();
router.get("/", (_req, res) => {
return res.status(200).json({
success: true,
message: "Users fetched successfully",
data: [],
});
});
export default router;Trade-Off
Minimal is fast to understand because there are fewer files. The cost is that route files can grow large as business rules increase.
If a route starts doing validation, business decisions, persistence, and response formatting in one place, move to modular or layered.