unreal-chat/apps/api
Juan Sebastian Montoya 3d41e2cc42 feat: add emoji picker to chat room message input
- Integrated emoji-picker-element library for emoji selection
- Added emoji toggle button in message input container
- Implemented emoji picker show/hide functionality
- Created CSS styles for emoji picker positioning
- Added event handling for emoji selection and outside click
- Updated package.json to include emoji-picker-element dependency
- Modified Prisma schema to use TEXT type for message content
- Updated Prisma migration scripts to use dotenv for environment configuration
2025-03-07 00:41:25 -05:00
..
prisma feat: add emoji picker to chat room message input 2025-03-07 00:41:25 -05:00
src chore: update environment configuration and deployment scripts 2025-03-06 23:08:10 -05:00
.dockerignore refactor: migrate from Next.js to SolidJS and GraphQL 2025-03-04 01:08:52 -05:00
.gitignore Feature/Use fastify instead of express () 2025-03-06 19:15:56 -05:00
Dockerfile chore: update environment configuration and deployment scripts 2025-03-06 23:08:10 -05:00
eslint.config.js Feature/Use fastify instead of express () 2025-03-06 19:15:56 -05:00
package.json feat: add emoji picker to chat room message input 2025-03-07 00:41:25 -05:00
README.md chore: update environment configuration and deployment scripts 2025-03-06 23:08:10 -05:00
tsconfig.json Feature/Use fastify instead of express () 2025-03-06 19:15:56 -05:00

Unreal Chat API

The backend API for the Unreal Chat application, built with Mercurius, GraphQL, and Prisma.

Features

  • GraphQL API with Mercurius
  • Real-time subscriptions for messages and rooms
  • Prisma ORM with MariaDB
  • User authentication
  • Chat rooms and messaging

Getting Started

Prerequisites

  • Node.js (v18 or later)
  • npm (v10 or later)
  • MariaDB or MySQL

Installation

  1. Install dependencies:
npm install
  1. Set up the database:

Make sure you have MariaDB running and update the connection string in prisma/.env if needed.

  1. Run Prisma migrations:
npm run prisma:migrate
  1. Start the development server:
npm run dev

The API will be available at http://localhost:4000/graphql.

Available Scripts

  • npm run dev - Start the development server
  • npm run build - Build the application
  • npm run start - Start the production server
  • npm run prisma:generate - Generate Prisma client
  • npm run prisma:migrate - Run Prisma migrations
  • npm run prisma:studio - Open Prisma Studio

API Documentation

Authentication

For development purposes, authentication is simplified. In a production environment, you would use JWT tokens.

GraphQL Schema

The GraphQL schema includes the following main types:

  • User: Represents a user in the system
  • Room: Represents a chat room
  • Message: Represents a message in a chat room

Queries

  • me: Get the current user
  • users: Get all users
  • user(id: ID!): Get a user by ID
  • rooms: Get all public rooms
  • room(id: ID!): Get a room by ID
  • messages(roomId: ID!): Get messages in a room

Mutations

  • register(email: String!, username: String!, password: String!): Register a new user
  • login(email: String!, password: String!): Login a user
  • createRoom(name: String!, description: String, isPrivate: Boolean): Create a new room
  • joinRoom(roomId: ID!): Join a room
  • leaveRoom(roomId: ID!): Leave a room
  • sendMessage(content: String!, roomId: ID!): Send a message to a room

Subscriptions

  • messageAdded(roomId: ID!): Subscribe to new messages in a room
  • roomAdded: Subscribe to new rooms