Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork0
Next-generation framework for building server-side applications with Node.js & TypeScript
License
lithia-framework/lithia
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Building APIs shouldn't require endless boilerplate, complex routing configurations, or juggling between multiple tools.Lithia changes that.
# Create a new Lithia projectnpx create-lithia-app my-apicd my-apinpm run dev
That's it. Your API is running, hot-reloading, and ready to develop with a beautiful web interface.
Traditional Node.js frameworks force you to:
- ❌ Manually configure every route
- ❌ Switch between code editor, terminal, and Postman/Insomnia
- ❌ Lose time with server restarts and debugging
- ❌ Fight with TypeScript configurations
Lithia gives you:
- ✅ File-based routing - folders become routes automatically
- ✅ Lithia Studio - develop, test, and debug in one place
- ✅ Instant hot reload - see changes in milliseconds
- ✅ TypeScript-first - full type safety out of the box
npx create-lithia-app my-apicd my-apinpm run dev// src/routes/users/route.get.tsexportdefaultasync(req,res)=>{constusers=[{id:1,name:'Alice'},{id:2,name:'Bob'},];returnres.json(users);};
That's it!GET /users is now live athttp://localhost:3000/users
// src/routes/users/[id]/route.get.tsexportdefaultasync(req,res)=>{const{ id}=req.params;// Your database logic hereconstuser=awaitdb.users.findById(id);if(!user){returnres.status(404).json({error:'User not found'});}returnres.json(user);};
NowGET /users/123 works automatically!
Lithia's killer feature:your folder structure IS your API structure. No configuration needed.
src/routes/├── users/│ ├── route.ts # Handles ALL methods on /users│ ├── route.post.ts # Handles ONLY POST /users│ └── [id]/│ ├── route.ts # All methods /users/:id│ └── route.put.ts # Only PUT /users/:id├── products/│ ├── route.get.ts # GET /products│ └── [slug]/│ └── route.ts # All methods /products/:slug└── api/ └── health/ └── route.get.ts # GET /api/health| File Pattern | What it does | Example URL |
|---|---|---|
route.ts | Handlesall HTTP methods | Any method on/path |
route.get.ts | Only GET requests | GET /path |
route.post.ts | Only POST requests | POST /path |
route.put.ts | Only PUT requests | PUT /path |
route.delete.ts | Only DELETE requests | DELETE /path |
[param]/ | Dynamic route parameter | /users/123 →params.id = "123" |
// src/routes/posts/route.post.tsexportdefaultasync(req,res)=>{const{ title, content}=req.body;constpost=awaitdb.posts.create({ title, content});returnres.status(201).json(post);};
// src/routes/posts/[id]/route.delete.tsexportdefaultasync(req,res)=>{const{ id}=req.params;awaitdb.posts.delete(id);returnres.status(204).send();};
The game-changer. Lithia Studio is a complete development environment in your browser.
Monitor your server's health at a glance:
- CPU and memory usage
- Request/response metrics
- Active connections
- Performance graphs
Visualize and test your entire API:
- See all routes in a tree structure
- Click to test any endpoint
- View request/response in real-time
- Inspect headers, body, and status codes
Create routes without touching code:
- Visual interface to build new routes
- Choose HTTP methods (GET, POST, PUT, DELETE)
- Set up dynamic parameters with
[id]syntax - Generate route files automatically
- Preview route structure before creation
- Edit the code before creating the route
Test your API endpoints instantly:
- Send requests with custom headers and body
- Test different HTTP methods
- View real-time responses
- Debug request/response flow
Never leave the browser:
- Stream logs in real-time
- Filter by level (info, warn, error)
- Syntax highlighting
- Search and export logs
See your server configuration in real-time:
- View current ports, CORS settings, middleware
- Monitor active configuration
- Inspect all server settings at a glance
The fastest development loop:
- Change a file → see results in milliseconds
- No manual server restarts
- No cache issues
- Just pure speed
Access Lithia Studio: When your server is running, Lithia Studio is automatically available athttp://localhost:8473
Full type safety without configuration:
// src/routes/api/users/route.post.tsimporttype{Request,Response}from'lithia';interfaceCreateUserBody{name:string;email:string;age:number;}exportdefaultasync(req:Request<CreateUserBody>,res:Response)=>{const{ name, email, age}=req.body;// Fully typed!// Your logic herereturnres.json({success:true});};
Extend Lithia at every lifecycle point:
// lithia.config.tsimport{defineLithiaConfig}from'lithia';importtype{LithiaConfig,LithiaRequest,LithiaResponse}from'lithia/types';constconfig:LithiaConfig={server:{port:3000,},hooks:{'request:before':(req:LithiaRequest,res:LithiaResponse)=>{console.log(`Incoming:${req.method}${req.url}`);},'request:after':(req:LithiaRequest,res:LithiaResponse)=>{console.log(`Completed:${res.statusCode}`);},'request:error':(req:LithiaRequest,res:LithiaResponse,error:Error,)=>{console.error('Request error:',error);},'middleware:beforeExecute':(middleware,req,res)=>{console.log(`Executing middleware:${middleware.name}`);},'middleware:afterExecute':(middleware,req,res)=>{console.log(`Middleware completed:${middleware.name}`);},'middleware:error':(middleware,req,res,error)=>{console.error(`Middleware error in${middleware.name}:`,error);},},};exportdefaultdefineLithiaConfig(config);
Available hooks:
request:before- Before request processingrequest:after- After request completionrequest:error- When request failsmiddleware:beforeExecute- Before each middleware runsmiddleware:afterExecute- After each middleware completesmiddleware:error- When middleware throws error
Change your code and see resultsinstantly:
- No server restarts
- No manual refreshes
- State preservation when possible
- Works with Lithia Studio
Add middleware directly to your routes:
// src/routes/api/users/route.get.ts// Define middlewares for this routeexportconstmiddlewares=[async(req,res,next)=>{// Authentication middlewareif(!req.headers.authorization){returnres.status(401).json({error:'Unauthorized'});}next();},async(req,res,next)=>{// Logging middlewareconsole.log(`${req.method}${req.url}`);next();},];// Your route handlerexportdefaultasync(req,res)=>{constusers=awaitdb.users.findAll();returnres.json(users);};
| Feature | Lithia | Express | NestJS |
|---|---|---|---|
| File-based Routing | ✅ | ❌ | ❌ |
| Built-in Dev Interface | ✅ | ❌ | ❌ |
| TypeScript-First | ✅ | ✅ | |
| Hot Reload | ✅ | ❌ | ❌ |
| Zero Configuration | ✅ | ❌ | ❌ |
| Learning Curve | Low | Low | High |
| Boilerplate | Minimal | Medium | Heavy |
// src/routes/api/todos/route.get.tsexportdefaultasync(req,res)=>{consttodos=awaitdb.todos.findAll();returnres.json(todos);};// src/routes/api/todos/route.post.tsexportdefaultasync(req,res)=>{const{ title}=req.body;consttodo=awaitdb.todos.create({ title,completed:false});returnres.status(201).json(todo);};// src/routes/api/todos/[id]/route.put.tsexportdefaultasync(req,res)=>{const{ id}=req.params;const{ completed}=req.body;consttodo=awaitdb.todos.update(id,{ completed});returnres.json(todo);};// src/routes/api/todos/[id]/route.delete.tsexportdefaultasync(req,res)=>{const{ id}=req.params;awaitdb.todos.delete(id);returnres.status(204).send();};
That's a complete CRUD API in 4 files. No routing configuration. No boilerplate.
Visitlithiajs.com for:
- Complete API reference
- In-depth guides and tutorials
- Best practices
- Migration guides
- Examples and templates
We love contributions! Before getting started, please read ourContributing Guidelines.
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/lithia.git - Install dependencies:
npm install - Create a branch:
git checkout -b feature/amazing-feature - Make your changes
- Test your changes:
npm test - Commit using conventional commits:
git commit -m "feat: add amazing feature" - Push to your branch:
git push origin feature/amazing-feature - Open a Pull Request
- Bug Reports - Use the bug report template
- Feature Requests - Use the feature request template
- Documentation - Improvements always welcome
- Ideas - Share inDiscussions
- GitHub Discussions - Ask questions, share ideas
- GitHub Issues - Report bugs
- Email - Direct contact
- OpenCollective - Support the project
If Lithia makes your life easier, consider supporting it:
- Star this repository
- Share on social media
- Sponsor viaOpenCollective
- Report bugs and suggest improvements
- Improve documentation
Lithia isMIT licensed. Free for personal and commercial use.
Built with ❤️ by the Lithia community
About
Next-generation framework for building server-side applications with Node.js & TypeScript
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.





