A Modelence project follows a well-organized structure that clearly separates client and server code, making it easy to build full-stack applications with TypeScript.Documentation Index
Fetch the complete documentation index at: https://docs.modelence.com/llms.txt
Use this file to discover all available pages before exploring further.
Directory Overview
When you create a new Modelence project, you’ll see the following structure:Client Directory
Thesrc/client directory contains all your frontend React application code.
Key Files
-
index.html- The main HTML template for your application. You typically don’t need to modify this file unless you want to add meta tags, external scripts, or customize the root template. -
index.tsx- The React application entry point. This is where you initialize your client-side app usingrenderApp()and configure providers. -
index.css- Global CSS styles for your application. This file typically includes Tailwind CSS imports and any global style customizations. -
routes.ts- Client-side routing configuration that maps URL paths to React components.
Organizing Client Code
Within theclient directory, you can organize your code into subdirectories:
Server Directory
Thesrc/server directory contains all your backend code, including API logic, database models, and business logic.
Key Files
-
app.ts- The server entry point where you configure and start your Modelence application.
Organizing Server Code by Modules
The recommended approach is to organize server code into modules - self-contained units of functionality:- Module definition - Queries, mutations, and configuration
- Database stores - MongoDB collection definitions
- Business logic - Domain-specific utilities and helpers
src/server/migrations.ts and pass them to startApp({ migrations }).
Shared Code
You can create asrc/shared directory (or any other name) for code that needs to be used by both client and server:
Configuration Files
.modelence.env
Environment-specific configuration for your application. This file should never be committed to version control.package.json
Standard Node.js package configuration. Modelence projects include these key scripts:tsconfig.json
TypeScript configuration for your project. Modelence sets up appropriate defaults for both client and server code with path aliases and module resolution.Build Output
When you build your application withnpm run build, Modelence generates a dist directory:
Next Steps
Modules
Learn how to organize your application logic into modules
Configuration
Understand how to configure your Modelence application