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.
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 using renderApp() and configure providers.
import { renderApp } from 'modelence/client';import routes from './routes';import './index.css';renderApp({ routes,});
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.
import { createBrowserRouter } from 'react-router-dom';import Home from './pages/Home';import About from './pages/About';export default createBrowserRouter([ { path: '/', element: <Home /> }, { path: '/about', element: <About /> },]);
Module definition - Queries, mutations, and configuration
Database stores - MongoDB collection definitions
Business logic - Domain-specific utilities and helpers
For data evolution over time, you can keep app-level migration scripts in
src/server/migrations.ts and pass them to startApp({ migrations }).
Grouping code by modules (domains/features) rather than by type (controllers, models, etc.) makes your codebase more maintainable and easier to understand as it grows.
TypeScript configuration for your project. Modelence sets up appropriate defaults for both client and server code with path aliases and module resolution.