@prjq/q-core
v0.0.0-alpha.6
Published
A typescript meta framework for instant, scalable APIs. Designed to eliminate hours of boilerplate and enhance developer experience for scalable backend systems.
Readme
Q-Core
An opinionated, Typescript-first meta-framework built on Express.js and Zod. Enables you to build Node.js API with less boilerplate.
Note: The core library is database-agnostic. While it currently provides out-of-the-box support only for Prisma. Support for more ORMs and databases is planned for future releases.
Quick Start
Prerequisite: A working Prisma setup. This tutorial uses the provided
PrismaDAOandPrismaServicewhich requires @prisma/client and a configured database.
This example creates a fully-typed, production-ready CRUD API for a User resource.
1. Installation
npm install @prjq/q-core express zod @prisma/client2. Create a database schema
model user {
id String @unique @default(uuid())
name String
email String @unique
}3. Create a validation schema
// user.schema.ts
import { z } from "zod";
export const userSchema = z.object({
id: z.string(),
email: z.string().email(),
name: z.string().min(2),
});4. Make the magic happen
// app.ts
import { Q } from "@prjq/q-core";
import { userSchema } from "./user.schema";
import express from "express";
export const app = express();
// Full CRUD API in one line
const userRouter = Q.router({
name: "user", // Your Prisma model name
baseSchema: userSchema,
autoFields: { idField: "id" }, // We'll find the rest automatically
});
app.use("/api/users", userRouter);5. Run the app
import { PrismaClient } from "@prisma/client";
import { Q } from "@prjq/q-core";
const prisma = new PrismaClient();
const db = Q.service(prisma); // Connect the dots
// Optional: Start with our Express setup
const app = express();
const server = Q.express(app, db);6. Run Your API
npm run devYour API now has:
GET /api/users- Get all usersPOST /api/users- Create user (with auto-validation!)GET /api/users/:id- Get specific userPUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
Why You'll Love This
- ✅ Zero Boilerplate - Stop writing the same CRUD code repeatedly
- ✅ Type-Safe Everything - Zod + TypeScript = fewer "it worked on my machine" moments
- ✅ Built-in Best Practices - Validation, error handling, security included
- ✅ Actually Enjoyable - Because life's too short for repetitive coding
Ready for More?
Check out our docs for the fancy stuff
- Custom validation hooks
- Authentication integration
- Rate limiting
- And other things that make your API actually production-ready
We welcome contributions from the community! Please remember to follow our Contributor Guidelines and respect our Code of Conduct.
