refactor: migrate from Next.js to SolidJS and GraphQL
- Converted web application from Next.js to SolidJS with Vite - Replaced React components with SolidJS components - Implemented GraphQL client using URQL - Added authentication, room, and chat components - Updated project structure and configuration files - Removed unnecessary Next.js and docs-related files - Added Docker support for web and API applications
This commit is contained in:
parent
8f3aa2fc26
commit
16731409df
81 changed files with 13585 additions and 1163 deletions
91
apps/api/README.md
Normal file
91
apps/api/README.md
Normal file
|
@ -0,0 +1,91 @@
|
|||
# Unreal Chat API
|
||||
|
||||
The backend API for the Unreal Chat application, built with Apollo Server, GraphQL, and Prisma.
|
||||
|
||||
## Features
|
||||
|
||||
- GraphQL API with Apollo Server
|
||||
- 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:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Set up the database:
|
||||
|
||||
Make sure you have MariaDB running and update the connection string in `prisma/.env` if needed.
|
||||
|
||||
3. Run Prisma migrations:
|
||||
|
||||
```bash
|
||||
npm run prisma:migrate
|
||||
```
|
||||
|
||||
4. Start the development server:
|
||||
|
||||
```bash
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue