Skip to content

The Zero-Config TypeScript Framework for Modern Backends.

License

Notifications You must be signed in to change notification settings

riktaHQ/rikta.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

77 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🧭 Rikta

The Zero-Config TypeScript Framework for Modern Backends.

Build scalable APIs with the power of Fastify and the elegance of decorators. No modules. No boilerplate. Just code.

NPM Version License


Rikta installed

πŸ€” Why Rikta?

Do you miss the simplicity of Express but need the structure of a real framework?

Rikta is designed for developers who want to move fast without breaking things.

  • πŸš€ Zero-Config Autowiring: No imports: [], exports: [], or providers: [] arrays. Just decorate your class, and it works.
  • ⚑ Fastify Powered: Built on top of Fastify for maximum performance and low overhead.
  • πŸ›‘οΈ Type-Safe by Default: Native Zod integration for validation that infers your TypeScript types automatically.
  • πŸ”„ Hybrid Lifecycle: Powerful hooks and an event bus for complex application flows.

Rikta is nordic for "guide". Let Rikta guide you to build better backends, faster.


⚑ Quick Start

Get up and running in seconds with the Rikta CLI:

# Create a new project
npx @riktajs/cli new my-app

# Start development
cd my-app
npm run dev

That's it! πŸŽ‰ Your API is running at http://localhost:3000

What you get

The CLI generates a complete project with:

  • βœ… TypeScript configuration optimized for Rikta
  • βœ… Example controller with REST endpoints
  • βœ… Example service with dependency injection
  • βœ… Hot reload development server
  • βœ… Production build for serverless deployment

Generated Code Example

// src/controllers/app.controller.ts
import { Controller, Get, Autowired } from '@riktajs/core';
import { GreetingService } from '../services/greeting.service.js';

@Controller()
export class AppController {
  @Autowired()
  private greetingService!: GreetingService;

  @Get('/')
  index() {
    return { message: this.greetingService.getGreeting() };
  }

  @Get('/health')
  health() {
    return { status: 'ok', timestamp: new Date().toISOString() };
  }
}
// src/services/greeting.service.ts
import { Injectable } from '@riktajs/core';

@Injectable()
export class GreetingService {
  getGreeting(): string {
    return 'Welcome to Rikta! πŸš€';
  }
}

πŸ“¦ Packages

Package Description Version
@riktajs/core Core framework with DI, routing, and validation npm
@riktajs/cli CLI for scaffolding and development npm
@riktajs/swagger OpenAPI/Swagger documentation npm
@riktajs/typeorm TypeORM integration npm
@riktajs/queue BullMQ-based job queue integration for Rikta npm

πŸ› οΈ CLI Commands

Command Description
rikta new <name> Create a new Rikta project
rikta dev Start development server with hot reload
rikta build Build for production (serverless optimized)
# Global installation (optional)
npm install -g @riktajs/cli

# Or use npx directly
npx @riktajs/cli new my-app

See the CLI Guide for full documentation.


πŸ“š Documentation

Everything you need to build production-ready APIs.

Guide Description
Architecture How Rikta's auto-discovery works under the hood.
Dependency Injection Using @Autowired, tokens, and scopes.
Configuration Type-safe configuration with .env and Zod validation.
Routing Controllers, methods, and parameter handling.
Validation New! Type-safe validation with Zod.
Lifecycle Hooks (OnProviderInit) and the Event Bus.
Error Handling Exception filters and standard JSON responses.
CLI Guide Using the Rikta CLI.
Benchmarks Performance comparison with Fastify & NestJS.

⚑ Performance

Rikta is built on Fastify and delivers excellent performance. From our benchmarks:

Metric Rikta vs NestJS Result
Startup 🟒 -43% Rikta is faster
GET requests 🟒 -41% Rikta is faster
POST requests 🟒 -25% Rikta is faster
Param requests 🟒 -46% Rikta is faster
Average 🟒 ~40% Rikta is faster

Rikta adds minimal overhead (~2-5%) over vanilla Fastify while providing DI, decorators, and structured architecture.

For detailed tests:

cd benchmarks
npm install
npm run bench

Production Mode

For maximum performance, use silent mode:

const app = await Rikta.create({
  port: 3000,
  silent: true,   // Disable all console output
  logger: false   // Disable Fastify logging
});

✨ Key Features

🚫 No Modules, Just Logic

Forget about AppModule, UserModule, SharedModule. Rikta scans your code and resolves dependencies automatically.

βœ… Native Zod Validation

Don't duplicate your types. Define a Zod schema, and Rikta validates the request and gives you the TypeScript type.

@Post()
create(@Body(UserSchema) user: z.infer<typeof UserSchema>) {
  // If we get here, 'user' is valid and typed.
  // If not, Rikta returns a 400 Bad Request automatically.
}

πŸ”Œ Powerful Dependency Injection

Support for Singleton (default) and Transient scopes, factory providers, and value tokens.

@Injectable()
class AuthService {
  constructor(
    @Autowired(DB_CONFIG) private config: Config,
    @Autowired() private logger: LoggerService
  ) {}
}

πŸ’– Sponsors

Rikta is proudly sponsored by:

Artiforge

Artiforge - AI-powered development tools


🀝 Contributing

We love contributions! Please check our Contributing Guide (Coming Soon) and join our community.

πŸ“„ License

Rikta is MIT licensed.