A full-featured application built using the latest Next.js conventions with end-to-end type safety powered by Igniter.js.
Discover other templates that might interest you based on similar technologies and use cases.
A full-featured real-time chat application built with Next.js and Prisma, showcasing Igniter.js's SSE-based real-time features for instant updates.
Build your SaaS in a weekend. Every SaaS starts with the same basic code - stop reinventing the wheel.
A modern full-stack application built with TanStack Start featuring type-safe routing and server functions.
@felipebarcelospro
Fundador e Criador de Conteúdo na Vibe Dev | AI | Blockchain | Inteligência Artificial | Web3 | Startups | Crypto | SaaS | Micro-SaaS
Welcome to the Igniter.js starter for building full-stack, type-safe applications with Next.js. This template provides a solid foundation for creating modern, high-performance web applications featuring server components, client components, and an end-to-end type-safe API layer.
Before you begin, ensure you have the following installed:
Follow these steps to get your project up and running:
Clone the Repository
git clone https://github.com/felipebarcelospro/igniter-js.git
cd igniter-js/apps/starter-next-app
Install Dependencies
npm install
Configure Environment Variables
Create a .env
file in the root of this starter (igniter-js/apps/starter-next-app/.env
) and add your database and Redis connection URLs:
# .env
DATABASE_URL="postgresql://user:password@localhost:5432/mydatabase?schema=public"
REDIS_URL="redis://127.0.0.1:6379"
Run Database Migrations
npx prisma db push
Run the Development Server
npm run dev
This command starts the Next.js development server with Turbopack. Your application will be available at http://localhost:3000
.
This starter deeply integrates Igniter.js with the Next.js App Router.
The entry point for all API requests is the catch-all route handler located at src/app/api/[[...all]]/route.ts
. This file uses the nextRouteHandlerAdapter
from Igniter.js to expose the entire API.
// src/app/api/[[...all]]/route.ts
import { AppRouter } from '@/igniter.router'
import { nextRouteHandlerAdapter } from '@igniter-js/core/adapters'
// The adapter creates GET, POST, etc. handlers from your Igniter.js router.
export const { GET, POST, PUT, DELETE } = nextRouteHandlerAdapter(AppRouter)
The back-end API logic is defined using Igniter.js.
src/igniter.ts
)src/igniter.router.ts
)src/features/[feature]/controllers/
)Igniter.js automatically generates a type-safe client based on your API router.
api
object in src/igniter.client.ts
is your gateway to the back-end.Server Component Usage:
// app/some-server-page/page.tsx
import { api } from '@/igniter.client';
export default async function SomePage() {
// Direct, type-safe API call
const data = await api.example.health.query();
return <div>Status: {data.status}</div>;
}
Client Component Usage:
// components/SomeClientComponent.tsx
'use client';
import { api } from '@/igniter.client';
export function SomeClientComponent() {
// Type-safe hook for data fetching, caching, and revalidation
const { data, isLoading } = api.example.health.useQuery();
if (isLoading) return <div>Loading...</div>;
return <div>Status: {data?.status}</div>;
}
The project follows a feature-based architecture combined with Next.js conventions.
src/
├── app/ # Next.js App Router pages and layouts
│ └── api/ # API route handlers
│ └── [[...all]]/
│ └── route.ts # Igniter.js API entry point
├── components/ # Shared, reusable UI components
├── features/ # Business logic, grouped by feature
│ └── example/
│ └── controllers/ # API endpoint definitions
├── services/ # Service initializations (Redis, Prisma, etc.)
├── igniter.ts # Igniter.js core instance
├── igniter.client.ts # Auto-generated type-safe API client
├── igniter.router.ts # Main API router
└── layout.tsx # Root layout, includes providers
npm run dev
: Starts the development server.npm run build
: Builds the application for production.npm run start
: Starts the production server.npm run lint
: Runs the linter.To learn more about Igniter.js and its powerful features, check out the official documentation:
This starter is licensed under the MIT License.