Project Structure
A typical Fulgur project looks like this:
my-app/
├── .fulgur/
│ ├── start.ts # Generated — production server entry
│ └── vercel.ts # Generated — Vercel serverless handler
├── src/
│ ├── api/
│ │ └── hello.server.ts # Route module
│ ├── lib/
│ │ └── api.ts # Type-safe client
│ ├── route.server.ts # Server entry point (the only file Fulgur reads)
│ ├── App.tsx # React component
│ └── main.tsx # Client entry
├── index.html
├── vite.config.ts
├── tsconfig.json
├── tsconfig.client.json
└── tsconfig.server.jsonKey files
src/route.server.ts
The single entry point of your API. Fulgur reads this file's default export and uses it as the root Elysia instance. You compose all your routes here using .use().
import { Elysia } from "fulgur/server";
import { helloRoutes } from "./api/hello.server";
const app = new Elysia().use(helloRoutes);
export default app;
export type App = typeof app;src/**/*.server.ts
Files ending with .server.ts are server-only. They are never bundled into the client. The Vite plugin blocks any runtime import of these files from client code.
WARNING
Server files cannot be imported in client code. Fulgur will throw a build error if you try.
Type-only imports (import type) are safe — they are stripped before bundling.
.fulgur/
Auto-generated directory. Do not edit these files — they are regenerated on every vite dev and vite build.
| File | Purpose |
|---|---|
start.ts | Production server — serves static files and your API |
vercel.ts | Vercel serverless handler — wraps your API under /api |
INFO
Add .fulgur/ to your .gitignore.
TypeScript configuration
Fulgur uses a split tsconfig setup with project references:
| File | Purpose |
|---|---|
tsconfig.json | Root config with references |
tsconfig.client.json | Client types — includes src/, excludes *.server.ts |
tsconfig.server.json | Server types — includes only *.server.ts and vite.config.ts |
This ensures server-only code never leaks into your client bundle types.
