A secure and modern REST API built with Deno runtime and Igniter.js featuring built-in TypeScript support.
Discover other templates that might interest you based on similar technologies and use cases.
A robust REST API built with Express.js and Igniter.js featuring structured logging and background jobs.
A high-performance REST API built with Bun runtime and Igniter.js for maximum speed and efficiency.
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.
@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 high-performance, type-safe REST APIs with Deno. This template provides a robust and scalable foundation for creating modern back-end services.
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-deno-rest-api
Configure Environment Variables
Create a .env
file in the root of this starter (igniter-js/apps/starter-deno-rest-api/.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
This starter uses Prisma for database management. You'll need to add a task to your deno.json
to run migrations.
// deno.json
{
"tasks": {
"dev": "deno run --unstable-sloppy-imports --watch --allow-net --allow-env --import-map=import_map.json src/index.ts",
"start": "deno run --unstable-sloppy-imports --allow-net --allow-env --import-map=import_map.json src/index.ts",
"prisma:db:push": "deno run --unstable-sloppy-imports -A npm:prisma db push"
},
// ... rest of the file
}
Then, run the task:
deno task prisma:db:push
Run the Development Server
deno task dev
This command starts the Deno server with file watching enabled. Your API will be available at http://localhost:8000/api/v1
.
This starter is a pure API server built on Deno's standard library.
src/index.ts
)The src/index.ts
file is the main entry point. It uses serve
from deno.land/std/http
to handle incoming requests. A simple path-based router checks if the request URL starts with /api/v1/
and, if so, forwards it to the Igniter.js API router handler.
The back-end API is defined using Igniter.js.
src/igniter.ts
)src/igniter.router.ts
)src/features/example/controllers/example.controller.ts
)src/services/
)The project follows a feature-based architecture to promote scalability and separation of concerns.
src/
├── 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 (for consumers)
├── igniter.context.ts # Application context definition
├── igniter.router.ts # Main API router
└── index.ts # Application entry point (Deno server)
This starter comes with a pre-built example
controller to demonstrate key features.
Health Check
curl http://localhost:8000/api/v1/example/
Cache Demonstration
# First request (live data)
curl http://localhost:8000/api/v1/example/cache/my-key
# Second request (cached data)
curl http://localhost:8000/api/v1/example/cache/my-key
Schedule a Background Job
curl -X POST -H "Content-Type: application/json" \
-d '{"message": "Hello from curl"}' \
http://localhost:8000/api/v1/example/schedule-job
List Jobs
curl http://localhost:8000/api/v1/example/jobs
Tasks are defined in deno.json
.
deno task dev
: Starts the development server with file watching.deno task start
: Starts the application for production.To learn more about Igniter.js and its powerful features, check out the official documentation:
This starter is licensed under the MIT License.