Introduction

Primate: The Agile Express & Prisma Framework 🚀

Welcome to Primate, an innovative framework that seamlessly integrates the power of Express with the elegance of Prisma. Primate is meticulously designed to accelerate the development of your web applications, ensuring that you spend less time on boilerplate code and more on crafting unique features.

Why Primate? 🌟

  • Rapid Development: With Primate, your project leaps forward. Our framework reduces setup time, allowing you to dive straight into the creative part of development.

  • Seamless Integration: Primate flawlessly combines Express's flexibility with Prisma's robust database management, offering a streamlined, powerful backend solution.

  • Scalable Architecture: Whether you're building a small application or a large-scale project, Primate's architecture adapts to your needs, ensuring smooth scaling and performance.

  • Developer-Friendly: We prioritize your experience. Primate offers detailed documentation, easy-to-understand code structure, and a supportive community.

Key Features ✨

https://github.com/quantum-coders/quantum-api/blob/main/prisma/schema.prisma
generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "mysql"
  url      = env("DATABASE_URL")
}

model Attachment {
  id         Int      @id @default(autoincrement())
  slug       String   @unique
  name       String   @default("")
  attachment String   @default("")
  mime       String   @default("")
  size       Int      @default(0)
  source     String   @default("")
  acl        String   @default("")
  metas      Json?    @default("{}")
  created    DateTime @default(now())
  modified   DateTime @default(now())

  @@map("attachment")
}

model User {
  id        Int       @id @default(autoincrement())
  uid       String    @unique @default(cuid())
  username  String    @unique
  email     String    @unique
  firstname String
  lastname  String
  nicename  String
  password  String?
  type      String    @default("User")
  status    String    @default("Active")
  language  String    @default("es")
  metas     Json?     @default("{}")
  created   DateTime  @default(now())
  modified  DateTime  @default(now())
  messages  Message[]
  chats     Chat[]
  rims      Rim[]

  @@map("user")
}

model Chat {
  id         Int       @id @default(autoincrement())
  idUser     Int       @map("id_user")
  idExternal String?   @unique @map("external_id")
  type       String    @default("telegram")
  title      String? // Opcional, podría ser útil para grupos o chats temáticos
  created    DateTime  @default(now()) @map("created")
  modified   DateTime  @default(now()) @map("modified")
  messages   Message[]

  user User @relation(fields: [idUser], references: [id])

  @@map("chat")
}

model Message {
  id            Int      @id @default(autoincrement())
  content       String   @db.LongText
  messageType   String   @map("message_type")
  idUser        Int      @map("id_user")
  idChat        Int      @map("id_chat")
  responseTo    Int?     @map("response_to")
  attachmentUrl String?  @map("attachment_url")
  created       DateTime @default(now()) @map("created")
  modified      DateTime @default(now()) @map("modified")

  parentMessage Message?  @relation("responses", fields: [responseTo], references: [id])
  responses     Message[] @relation("responses")
  user          User      @relation(fields: [idUser], references: [id])
  chat          Chat      @relation(fields: [idChat], references: [id])

  rims Rim[]

  @@map("message")
}

model Rim {
  id               Int       @id @default(autoincrement())
  idMessage        Int       @map("id_message")
  jsonData         Json      @map("json_data")
  version          String?
  userId           Int?      @map("user_id")
  expired          DateTime?
  interactionCount Int       @default(0)
  type             String?
  status           String    @default("active")
  created          DateTime  @default(now())
  modified         DateTime  @default(now())

  message Message @relation(fields: [idMessage], references: [id])
  user    User?   @relation(fields: [userId], references: [id])

  @@map("rim")
}
  • Express-Powered: Leverage the full potential of Express.js, the de facto standard for Node.js web applications.

  • Prisma Integration: Enjoy advanced database functionalities with Prisma, including easy data modeling and migrations.

  • Modular Design: Easily extend or customize your application with Primate's modular architecture.

  • Robust Security: Primate includes built-in security features to protect your application right out of the box.

  • Efficient ORM: Utilize Prisma’s Object-Relational Mapping to interact with your database using simple and intuitive queries.

Sure, here's the refactored text including the installation instructions for Yarn:

Getting Started 🚀

Primate is designed for ease of use. Here’s how you can get started:

Using npm:

npm i @thewebchimp/primate

Using Yarn:

yarn add @thewebchimp/primate
https://github.com/quantum-coders/quantum-nuxt/blob/main/composables/useAuth.js?plain=1#L1-L12
export const useAuth = () => {

	const authUser = useAuthUser();

	const setUser = (user) => {
		if(process.client && user && user.accessToken) localStorage.setItem('authToken', user.accessToken);
		authUser.value = user;
	};


	const getToken = () => {
		if(process.client) return localStorage.getItem('authToken');

Join the Troop 🐒

Be part of our growing community! Share your ideas, get help, and contribute to making Primate even better. Follow us on GitHub and join our community forums.

Embark on your development journey with Primate – where your ideas evolve rapidly into reality!

Last updated