@igniter-js/cli 0.4.4 → 0.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/index.mjs +5 -5
  2. package/dist/index.mjs.map +1 -1
  3. package/dist/templates/templates/add-ons/auth/better-auth/auth.hbs +37 -0
  4. package/dist/templates/templates/add-ons/bots/nextjs/route-handler.hbs +10 -0
  5. package/dist/templates/templates/add-ons/bots/sample-bot.hbs +26 -0
  6. package/dist/templates/templates/add-ons/bots/tanstack-start/route-handler.hbs +15 -0
  7. package/dist/templates/templates/add-ons/database/prisma/lib.hbs +11 -0
  8. package/dist/templates/templates/add-ons/database/prisma/prisma.config.hbs +13 -0
  9. package/dist/templates/templates/add-ons/database/prisma/schema.hbs +15 -0
  10. package/dist/templates/templates/add-ons/jobs/jobs.ts.hbs +32 -0
  11. package/dist/templates/templates/add-ons/jobs/redis.ts.hbs +13 -0
  12. package/dist/templates/templates/add-ons/jobs/store.ts.hbs +12 -0
  13. package/dist/templates/templates/add-ons/logging/logger.ts.hbs +14 -0
  14. package/dist/templates/templates/add-ons/mcp/mcp.ts.hbs +21 -0
  15. package/dist/templates/templates/add-ons/mcp/nextjs/route-handler.hbs +11 -0
  16. package/dist/templates/templates/add-ons/mcp/tanstack-start/route-handler.hbs +19 -0
  17. package/dist/templates/templates/add-ons/store/redis.ts.hbs +13 -0
  18. package/dist/templates/templates/add-ons/store/store.ts.hbs +12 -0
  19. package/dist/templates/templates/add-ons/telemetry/telemetry.ts.hbs +20 -0
  20. package/dist/templates/templates/generate/feature/empty.controller.hbs +20 -0
  21. package/dist/templates/templates/generate/feature/empty.interfaces.hbs +5 -0
  22. package/dist/templates/templates/generate/feature/procedure.hbs +23 -0
  23. package/dist/templates/templates/generate/feature/schema.controller.hbs +73 -0
  24. package/dist/templates/templates/generate/feature/schema.interfaces.hbs +23 -0
  25. package/dist/templates/templates/generate/feature/schema.procedure.hbs +23 -0
  26. package/dist/templates/templates/scaffold/example-feature/example.controller.hbs +23 -0
  27. package/dist/templates/templates/scaffold/example-feature/example.interfaces.hbs +14 -0
  28. package/dist/templates/templates/scaffold/example-feature/example.procedure.hbs +28 -0
  29. package/dist/templates/templates/scaffold/igniter.schema.hbs +21 -0
  30. package/dist/templates/templates/starters/igniter.client.hbs +52 -0
  31. package/dist/templates/templates/starters/igniter.context.hbs +10 -0
  32. package/dist/templates/templates/starters/igniter.hbs +43 -0
  33. package/dist/templates/templates/starters/igniter.router.hbs +14 -0
  34. package/dist/templates/templates/starters/nextjs/route-handler.hbs +8 -0
  35. package/dist/templates/templates/starters/nextjs/tsconfig.hbs +35 -0
  36. package/dist/templates/templates/starters/open-api.hbs +45 -0
  37. package/dist/templates/templates/starters/tanstack-start/route-handler.hbs +13 -0
  38. package/dist/templates/templates/starters/tanstack-start/tsconfig.hbs +15 -0
  39. package/package.json +4 -3
@@ -0,0 +1,37 @@
1
+ import { betterAuth } from "better-auth"
2
+ import { database } from "@/lib/database"
3
+ {{#if (eq addOnOptions.database.orm "prisma")}}
4
+ import { prismaAdapter } from "better-auth/adapters/prisma";
5
+ {{/if}}
6
+ {{#if (eq addOnOptions.database.orm "drizzle")}}
7
+ import { drizzleAdapter } from "better-auth/adapters/drizzle";
8
+ {{/if}}
9
+ {{{generatePluginImports addOnOptions.auth.plugins}}}
10
+
11
+ export const auth = betterAuth({
12
+ appName: process.env.IGNITER_APP_NAME,
13
+ appSecret: process.env.IGNITER_APP_SECRET,
14
+ baseURL: process.env.IGNITER_API_URL,
15
+ basePath: process.env.IGNITER_API_BASE_PATH,
16
+
17
+ {{#if addOnOptions.database.orm}}
18
+ // enable database adapter
19
+ database: {{#if (eq addOnOptions.database.orm "prisma")}}prismaAdapter{{/if}}{{#if (eq addOnOptions.database.orm "drizzle")}}drizzleAdapter{{/if}}(database, {
20
+ provider: "{{addOnOptions.database.provider}}", // or "mysql", "postgresql", ...etc
21
+ }),
22
+ {{/if}}
23
+
24
+ // enable email and password authentication
25
+ emailAndPassword: {
26
+ enabled: true,
27
+ },
28
+
29
+ {{#if addOnOptions.auth.plugins}}
30
+ // enable selected authentication plugins
31
+ plugins: [
32
+ {{#each addOnOptions.auth.plugins}}
33
+ {{camelCase this}}(){{#unless @last}},{{/unless}}
34
+ {{/each}}
35
+ ]
36
+ {{/if}}
37
+ })
@@ -0,0 +1,10 @@
1
+ import { sampleBot } from '@/bots/sample-bot';
2
+ import { nextRouteHandlerAdapter } from '@igniter-js/bot/adapters';
3
+
4
+ /**
5
+ * @description Next.js route handler for Igniter.js Bots
6
+ * @see https://igniterjs.com/docs/bots
7
+ */
8
+ export const { GET, POST } = nextRouteHandlerAdapter({
9
+ 'sample-bot': sampleBot,
10
+ });
@@ -0,0 +1,26 @@
1
+ import { IgniterBot } from '@igniter-js/bot'
2
+ import { telegram } from '@igniter-js/bot/adapters'
3
+
4
+ /**
5
+ * Create the bot using IgniterBot.
6
+ * This provides full type inference and a fluent API.
7
+ *
8
+ * @see https://igniterjs.com/docs/bots
9
+ */
10
+ export const sampleBot = IgniterBot
11
+ .create()
12
+ .withHandle('@my-bot') // ← Your bot's handle (ID and name auto-derived)
13
+ .addAdapter('telegram', telegram())
14
+ .addCommand('start', {
15
+ name: 'start',
16
+ aliases: ['hello'],
17
+ description: 'Start the bot',
18
+ help: 'Use /start to begin',
19
+ async handle(ctx) {
20
+ await ctx.reply('👋 Welcome! I am your bot.')
21
+ }
22
+ })
23
+ .onMessage(async (ctx) => {
24
+ await ctx.reply('👋 Welcome! I am your bot.')
25
+ })
26
+ .build()
@@ -0,0 +1,15 @@
1
+ import { createFileRoute } from '@tanstack/react-router'
2
+ import { tanstackStartRouteHandlerAdapter } from '@igniter-js/bot/adapters'
3
+ import { sampleBot } from '@/bots/sample-bot'
4
+
5
+ /**
6
+ * @description TanStack Start route handler for Igniter.js Bots
7
+ * @see https://igniterjs.com/docs/bots
8
+ */
9
+ export const Route = createFileRoute('/api/bots/$provider/$botId')({
10
+ server: {
11
+ handlers: tanstackStartRouteHandlerAdapter({
12
+ 'sample-bot': sampleBot,
13
+ }),
14
+ },
15
+ })
@@ -0,0 +1,11 @@
1
+ import { PrismaClient } from '../../prisma/client/client'
2
+
3
+ /**
4
+ * Prisma client instance for database operations.
5
+ *
6
+ * @remarks
7
+ * Provides type-safe database access with Prisma ORM.
8
+ *
9
+ * @see https://www.prisma.io/docs/concepts/components/prisma-client
10
+ */
11
+ export const database = new PrismaClient()
@@ -0,0 +1,13 @@
1
+ import { defineConfig, env } from "prisma/config";
2
+ import 'dotenv/config';
3
+
4
+ export default defineConfig({
5
+ schema: "prisma/schema.prisma",
6
+ migrations: {
7
+ path: "prisma/migrations",
8
+ },
9
+ engine: "classic",
10
+ datasource: {
11
+ url: env("DATABASE_URL"),
12
+ },
13
+ });
@@ -0,0 +1,15 @@
1
+ // This is your Prisma schema file,
2
+ // learn more about it in the docs: https://pris.ly/d/prisma-schema
3
+
4
+ // Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
5
+ // Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
6
+
7
+ generator client {
8
+ provider = "prisma-client"
9
+ output = "../prisma/client"
10
+ }
11
+
12
+ datasource db {
13
+ provider = "postgresql"
14
+ url = env("DATABASE_URL")
15
+ }
@@ -0,0 +1,32 @@
1
+ import { store } from './store'
2
+ import { createBullMQAdapter } from '@igniter-js/adapter-bullmq'
3
+ import { z } from 'zod'
4
+
5
+ /**
6
+ * Job queue adapter for background processing.
7
+ *
8
+ * @see https://igniterjs.com/docs/jobs
9
+ */
10
+ export const jobs = createBullMQAdapter({
11
+ store,
12
+ autoStartWorker: {
13
+ concurrency: 1,
14
+ queues: ['*']
15
+ }
16
+ })
17
+
18
+ export const REGISTERED_JOBS = jobs.merge({
19
+ system: jobs.router({
20
+ jobs: {
21
+ sampleJob: jobs.register({
22
+ name: 'sampleJob',
23
+ input: z.object({
24
+ message: z.string()
25
+ }),
26
+ handler: async ({ input }) => {
27
+ console.log(input.message)
28
+ }
29
+ })
30
+ }
31
+ })
32
+ })
@@ -0,0 +1,13 @@
1
+ import { Redis } from 'ioredis'
2
+
3
+ /**
4
+ * Redis client instance for caching, session storage, and pub/sub.
5
+ *
6
+ * @remarks
7
+ * Used for caching, session management, and real-time messaging.
8
+ *
9
+ * @see https://github.com/luin/ioredis
10
+ */
11
+ export const redis = new Redis(process.env.REDIS_URL!, {
12
+ maxRetriesPerRequest: null,
13
+ })
@@ -0,0 +1,12 @@
1
+ import { createRedisStoreAdapter } from '@igniter-js/adapter-redis'
2
+ import { redis } from './redis'
3
+
4
+ /**
5
+ * Store adapter for data persistence.
6
+ *
7
+ * @remarks
8
+ * Provides a unified interface for data storage operations using Redis.
9
+ *
10
+ * @see https://igniterjs.com/docs/store
11
+ */
12
+ export const store = createRedisStoreAdapter(redis)
@@ -0,0 +1,14 @@
1
+ import { createConsoleLogger, IgniterLogLevel } from '@igniter-js/core'
2
+
3
+ /**
4
+ * Logger instance for application logging.
5
+ *
6
+ * @remarks
7
+ * Provides structured logging with configurable log levels.
8
+ *
9
+ * @see https://github.com/felipebarcelospro/igniter-js/tree/main/packages/core
10
+ */
11
+ export const logger = createConsoleLogger({
12
+ level: IgniterLogLevel.INFO,
13
+ showTimestamp: true,
14
+ })
@@ -0,0 +1,21 @@
1
+ import { IgniterMcpServer } from '@igniter-js/adapter-mcp-server';
2
+ import { AppRouter } from '@/igniter.router';
3
+
4
+ /**
5
+ * Create the MCP server using the builder pattern.
6
+ * This provides full type inference and a fluent API.
7
+ *
8
+ * @see https://igniterjs.com/docs/mcp-server
9
+ */
10
+ export const mcpServer = IgniterMcpServer
11
+ .create()
12
+ .router(AppRouter)
13
+ .withServerInfo({
14
+ name: '{{capitalizeSlug projectName}} MCP Server',
15
+ version: '1.0.0',
16
+ })
17
+ .withAdapter({
18
+ redisUrl: process.env.REDIS_URL!,
19
+ basePath: process.env.IGNITER_MCP_SERVER_BASE_PATH || '/mcp'
20
+ })
21
+ .build();
@@ -0,0 +1,11 @@
1
+ import { mcpServer } from '@/igniter.mcp';
2
+
3
+ /**
4
+ * Export the handler for Next.js to handle both GET and POST requests,
5
+ * which are used by different MCP transport methods (like SSE and WebSockets).
6
+ */
7
+ export const GET = mcpServer.handler;
8
+ export const POST = mcpServer.handler;
9
+ export const PUT = mcpServer.handler;
10
+ export const DELETE = mcpServer.handler;
11
+ export const PATCH = mcpServer.handler;
@@ -0,0 +1,19 @@
1
+ import { createFileRoute } from '@tanstack/react-router';
2
+ import { mcpServer } from '@/igniter.mcp';
3
+
4
+ /**
5
+ * @description TanStack Start route handler adapter for Igniter.js
6
+ * @see https://igniterjs.com/docs/core/tanstack-start
7
+ */
8
+ export const Route = createFileRoute('/mcp/$')({
9
+ server: {
10
+ handlers: {
11
+ GET: ({ request }) => mcpServer.handler(request),
12
+ POST: ({ request }) => mcpServer.handler(request),
13
+ PUT: ({ request }) => mcpServer.handler(request),
14
+ DELETE: ({ request }) => mcpServer.handler(request),
15
+ PATCH: ({ request }) => mcpServer.handler(request),
16
+ },
17
+ }
18
+ })
19
+
@@ -0,0 +1,13 @@
1
+ import { Redis } from 'ioredis'
2
+
3
+ /**
4
+ * Redis client instance for caching, session storage, and pub/sub.
5
+ *
6
+ * @remarks
7
+ * Used for caching, session management, and real-time messaging.
8
+ *
9
+ * @see https://github.com/luin/ioredis
10
+ */
11
+ export const redis = new Redis(process.env.REDIS_URL!, {
12
+ maxRetriesPerRequest: null,
13
+ })
@@ -0,0 +1,12 @@
1
+ import { createRedisStoreAdapter } from '@igniter-js/adapter-redis'
2
+ import { redis } from './redis'
3
+
4
+ /**
5
+ * Store adapter for data persistence.
6
+ *
7
+ * @remarks
8
+ * Provides a unified interface for data storage operations using Redis.
9
+ *
10
+ * @see https://igniterjs.com/docs/store
11
+ */
12
+ export const store = createRedisStoreAdapter(redis)
@@ -0,0 +1,20 @@
1
+ import { createConsoleTelemetryAdapter } from '@igniter-js/core/adapters'
2
+ import { store } from './store'
3
+
4
+ /**
5
+ * Telemetry service for tracking requests and errors.
6
+ *
7
+ * @remarks
8
+ * Provides telemetry tracking with configurable options.
9
+ *
10
+ * @see https://github.com/felipebarcelospro/igniter-js/tree/main/packages/core
11
+ */
12
+ export const telemetry = createConsoleTelemetryAdapter({
13
+ serviceName: '{{capitalizeSlug projectName}}',
14
+ enableEvents: process.env.IGNITER_TELEMETRY_ENABLE_EVENTS === 'true',
15
+ enableMetrics: process.env.IGNITER_TELEMETRY_ENABLE_METRICS === 'true',
16
+ enableTracing: process.env.IGNITER_TELEMETRY_ENABLE_TRACING === 'true',
17
+ }, {
18
+ enableCliIntegration: process.env.IGNITER_TELEMETRY_ENABLE_CLI_INTEGRATION === 'true',
19
+ store: store
20
+ })
@@ -0,0 +1,20 @@
1
+ {{!--
2
+ @generated by @igniter-js/new-cli
3
+ @description Basic controller scaffold for a new feature
4
+ --}}
5
+ import { igniter } from '@/igniter'
6
+
7
+ export const {{controllerExport}} = igniter.controller({
8
+ name: '{{controllerDisplayName}}',
9
+ path: '/{{controllerRoute}}',
10
+ actions: {
11
+ hello: igniter.query({
12
+ name: 'Hello',
13
+ description: 'Demonstration endpoint',
14
+ path: '/hello',
15
+ handler: async ({ response }) => {
16
+ return response.success({ message: 'Hello from {{controllerDisplayName}}!' })
17
+ },
18
+ }),
19
+ },
20
+ })
@@ -0,0 +1,5 @@
1
+ {{!--
2
+ @generated by @igniter-js/new-cli
3
+ @description Placeholder interfaces file for a new feature
4
+ --}}
5
+ // Define Zod schemas and TypeScript types for the {{featureName}} feature here.
@@ -0,0 +1,23 @@
1
+ {{!--
2
+ @generated by @igniter-js/new-cli
3
+ @description Basic procedure scaffold for the {{featureName}} feature
4
+ --}}
5
+ import { igniter } from '@/igniter'
6
+
7
+ export const {{procedureExport}} = igniter.procedure({
8
+ name: '{{procedureDisplayName}}',
9
+ handler: async () => {
10
+ return {
11
+ {{procedureExport}}: {
12
+ services: {
13
+ example: () => {
14
+ return {
15
+ message: 'Hello from {{procedureDisplayName}}!',
16
+ timestamp: new Date().toISOString(),
17
+ }
18
+ },
19
+ },
20
+ },
21
+ }
22
+ },
23
+ })
@@ -0,0 +1,73 @@
1
+ {{!--
2
+ @generated by @igniter-js/new-cli
3
+ @description CRUD controller generated from the {{modelName}} Prisma model
4
+ --}}
5
+ import { igniter } from '@/igniter'
6
+ import { {{procedureExport}} } from '../procedures/{{featureName}}.procedure'
7
+ import { Create{{modelName}}InputSchema, Update{{modelName}}InputSchema } from '../{{featureName}}.interfaces'
8
+
9
+ export const {{controllerExport}} = igniter.controller({
10
+ name: '{{controllerDisplayName}}',
11
+ description: 'REST endpoints for {{modelNamePlural}}',
12
+ path: '/{{resourcePath}}',
13
+ actions: {
14
+ list: igniter.query({
15
+ name: 'List',
16
+ description: 'List {{modelNamePlural}}',
17
+ path: '/',
18
+ use: [{{procedureExport}}()],
19
+ handler: async ({ context, response }) => {
20
+ const records = await context.{{procedureExport}}.services.findAll()
21
+ return response.success(records)
22
+ },
23
+ }),
24
+ getById: igniter.query({
25
+ name: 'Get By Id',
26
+ description: 'Get {{modelName}} by id',
27
+ path: '/:id' as const,
28
+ use: [{{procedureExport}}()],
29
+ handler: async ({ request, context, response }) => {
30
+ const record = await context.{{procedureExport}}.services.findById(request.params.id)
31
+ if (!record) {
32
+ return response.notFound('{{modelName}} not found')
33
+ }
34
+ return response.success(record)
35
+ },
36
+ }),
37
+ create: igniter.mutation({
38
+ name: 'Create',
39
+ description: 'Create {{modelName}}',
40
+ path: '/',
41
+ method: 'POST',
42
+ body: Create{{modelName}}InputSchema,
43
+ use: [{{procedureExport}}()],
44
+ handler: async ({ request, context, response }) => {
45
+ const created = await context.{{procedureExport}}.services.create(request.body)
46
+ return response.created(created)
47
+ },
48
+ }),
49
+ update: igniter.mutation({
50
+ name: 'Update',
51
+ description: 'Update {{modelName}}',
52
+ path: '/:id' as const,
53
+ method: 'PUT',
54
+ body: Update{{modelName}}InputSchema,
55
+ use: [{{procedureExport}}()],
56
+ handler: async ({ request, context, response }) => {
57
+ const updated = await context.{{procedureExport}}.services.update(request.params.id, request.body)
58
+ return response.success(updated)
59
+ },
60
+ }),
61
+ delete: igniter.mutation({
62
+ name: 'Delete',
63
+ description: 'Delete {{modelName}}',
64
+ path: '/:id' as const,
65
+ method: 'DELETE',
66
+ use: [{{procedureExport}}()],
67
+ handler: async ({ request, context, response }) => {
68
+ await context.{{procedureExport}}.services.delete(request.params.id)
69
+ return response.noContent()
70
+ },
71
+ }),
72
+ },
73
+ })
@@ -0,0 +1,23 @@
1
+ {{!--
2
+ @generated by @igniter-js/new-cli
3
+ @description Zod schemas and TypeScript types generated from the {{modelName}} Prisma model
4
+ --}}
5
+ import { z } from 'zod'
6
+
7
+ export const {{modelName}}Schema = z.object({
8
+ {{#each fields}}
9
+ {{name}}: {{zodType}}{{#unless @last}},{{/unless}}
10
+ {{/each}}
11
+ })
12
+
13
+ export const Create{{modelName}}InputSchema = {{modelName}}Schema.omit({
14
+ {{#each createOmitFields}}
15
+ {{this}}: true{{#unless @last}},{{/unless}}
16
+ {{/each}}
17
+ })
18
+
19
+ export const Update{{modelName}}InputSchema = Create{{modelName}}InputSchema.partial()
20
+
21
+ export type {{modelName}} = z.infer<typeof {{modelName}}Schema>
22
+ export type Create{{modelName}}Input = z.infer<typeof Create{{modelName}}InputSchema>
23
+ export type Update{{modelName}}Input = z.infer<typeof Update{{modelName}}InputSchema>
@@ -0,0 +1,23 @@
1
+ {{!--
2
+ @generated by @igniter-js/new-cli
3
+ @description CRUD procedure generated from the {{modelName}} Prisma model
4
+ --}}
5
+ import { igniter } from '@/igniter'
6
+ import type { Create{{modelName}}Input, Update{{modelName}}Input } from '../{{featureName}}.interfaces'
7
+
8
+ export const {{procedureExport}} = igniter.procedure({
9
+ name: '{{procedureDisplayName}}',
10
+ handler: async (_options, { context }) => {
11
+ return {
12
+ {{procedureExport}}: {
13
+ services: {
14
+ findAll: () => context.services.database.{{prismaDelegate}}.findMany(),
15
+ findById: (id: {{idType}}) => context.services.database.{{prismaDelegate}}.findUnique({ where: { id } }),
16
+ create: (data: Create{{modelName}}Input) => context.services.database.{{prismaDelegate}}.create({ data }),
17
+ update: (id: {{idType}}, data: Update{{modelName}}Input) => context.services.database.{{prismaDelegate}}.update({ where: { id }, data }),
18
+ delete: (id: {{idType}}) => context.services.database.{{prismaDelegate}}.delete({ where: { id } }),
19
+ }
20
+ }
21
+ }
22
+ }
23
+ })
@@ -0,0 +1,23 @@
1
+ import { igniter } from '@/igniter'
2
+ import { ExampleProcedure } from '../procedures/example.procedure'
3
+
4
+ /**
5
+ * @description Example controller demonstrating Igniter.js features
6
+ * @see https://igniterjs.com/docs/core/controllers
7
+ */
8
+ export const ExampleController = igniter.controller({
9
+ name: 'Example',
10
+ path: '/example',
11
+ actions: {
12
+ // Health check action
13
+ health: igniter.query({
14
+ name: 'health',
15
+ description: 'Health check',
16
+ path: '/',
17
+ use: [ExampleProcedure()],
18
+ handler: async ({ request, response, context }) => {
19
+ return response.success(context.example.hello())
20
+ }
21
+ }),
22
+ }
23
+ })
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Example feature interfaces and types
3
+ * @description Define your feature's types here
4
+ */
5
+ export interface ExampleHelloResponse {
6
+ status: string
7
+ timestamp: string
8
+ features: {
9
+ store: boolean
10
+ jobs: boolean
11
+ logging: boolean
12
+ telemetry: boolean
13
+ }
14
+ }
@@ -0,0 +1,28 @@
1
+ import { igniter } from "@/igniter";
2
+ import type { ExampleHelloResponse } from "../example.interfaces";
3
+
4
+ /**
5
+ * @description Example procedure demonstrating Igniter.js features
6
+ * @see https://igniterjs.com/docs/core/procedures
7
+ */
8
+ export const ExampleProcedure = igniter.procedure({
9
+ name: 'ExampleProcedure',
10
+ handler(options, { request, response, context }) {
11
+ return {
12
+ example: {
13
+ hello: (): ExampleHelloResponse => {
14
+ return {
15
+ status: 'ok',
16
+ timestamp: new Date().toISOString(),
17
+ features: {
18
+ store: !!igniter.store,
19
+ jobs: !!igniter.jobs,
20
+ logging: !!igniter.logger,
21
+ telemetry: !!igniter.telemetry,
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
27
+ },
28
+ })
@@ -0,0 +1,21 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+
4
+ /**
5
+ * Generated by @igniter-js/cli
6
+ *
7
+ * WARNING: DO NOT EDIT THIS FILE MANUALLY
8
+ *
9
+ * This file was automatically generated from your Igniter router.
10
+ * Any changes made to this file will be overwritten when the CLI regenerates it.
11
+ *
12
+ * To modify the client API, update your controller files instead.
13
+ *
14
+ * Generated: {{generatedAt}}
15
+ */
16
+
17
+ // Generated by @igniter-js/cli - DO NOT EDIT
18
+
19
+ export const AppRouterSchema = {{{schemaString}}} as const
20
+
21
+ export type AppRouterSchemaType = typeof AppRouterSchema
@@ -0,0 +1,52 @@
1
+ /* eslint-disable */
2
+ /* prettier-ignore */
3
+ /* biome-ignore */
4
+
5
+ import { createIgniterClient, useIgniterQueryClient } from '@igniter-js/core/client'
6
+ import type { AppRouterType } from './igniter.router'
7
+
8
+ /**
9
+ * ⚠️ WARNING! ⚠️
10
+ *
11
+ * This file is auto-generated.
12
+ * DO NOT EDIT OR MODIFY THIS FILE DIRECTLY!
13
+ * Your changes will be lost if this file is regenerated.
14
+ *
15
+ * Any manual changes should be made in your source router or schema files.
16
+ * For more information, visit:
17
+ * https://igniterjs.com/docs/core/client
18
+ */
19
+
20
+
21
+ /**
22
+ * Type-safe API client generated from your Igniter router
23
+ *
24
+ * Usage in Server Components:
25
+ * const users = await api.users.list.query()
26
+ *
27
+ * Usage in Client Components:
28
+ * const { data } = api.users.list.useQuery()
29
+ *
30
+ * Note: Adjust environment variable prefixes (e.g., NEXT_PUBLIC_, BUN_PUBLIC_, DENO_PUBLIC_, REACT_APP_)
31
+ * @see https://igniterjs.com/docs/core/client
32
+ */
33
+ export const api = createIgniterClient<AppRouterType>({
34
+ baseURL: process.env.IGNITER_API_URL || 'http://localhost:3000',
35
+ basePATH: process.env.IGNITER_API_BASE_PATH || '/api/v1',
36
+ router: () => {
37
+ if (typeof window === 'undefined') {
38
+ return require('./igniter.router').AppRouter
39
+ }
40
+
41
+ return require('./igniter.schema').AppRouterSchema
42
+ },
43
+ })
44
+
45
+ /**
46
+ * Type-safe query client generated from your Igniter router
47
+ *
48
+ * Usage in Client Components:
49
+ * const { invalidate } = useQueryClient()
50
+ * @see https://igniterjs.com/docs/core/client
51
+ */
52
+ export const useQueryClient = useIgniterQueryClient<AppRouterType>;
@@ -0,0 +1,10 @@
1
+
2
+ /**
3
+ * @description Create the context of the Igniter.js application
4
+ * @see https://igniterjs.com/docs/core/context
5
+ */
6
+ export const createIgniterAppContext = () => {
7
+ return {
8
+ // Add application-wide context properties here, like database clients.
9
+ }
10
+ }