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
|
@ -1,36 +1,104 @@
|
|||
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/create-next-app).
|
||||
# Unreal Chat Web
|
||||
|
||||
The frontend web application for Unreal Chat, built with SolidJS and URQL GraphQL client.
|
||||
|
||||
## Features
|
||||
|
||||
- Real-time chat with GraphQL subscriptions
|
||||
- User authentication
|
||||
- Chat room management
|
||||
- Message sending and receiving
|
||||
- Responsive design
|
||||
|
||||
## Getting Started
|
||||
|
||||
First, run the development server:
|
||||
### Prerequisites
|
||||
|
||||
- Node.js (v18 or later)
|
||||
- npm (v10 or later)
|
||||
|
||||
### Installation
|
||||
|
||||
1. Install dependencies:
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
2. Set up environment variables:
|
||||
|
||||
Create a `.env` file in the root directory with the following variables:
|
||||
|
||||
```
|
||||
VITE_API_URL=http://localhost:4000/graphql
|
||||
VITE_WS_URL=ws://localhost:4000/graphql
|
||||
```
|
||||
|
||||
3. Start the development server:
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
# or
|
||||
yarn dev
|
||||
# or
|
||||
pnpm dev
|
||||
# or
|
||||
bun dev
|
||||
```
|
||||
|
||||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
||||
The web app will be available at http://localhost:5173.
|
||||
|
||||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
|
||||
## Available Scripts
|
||||
|
||||
This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load Inter, a custom Google Font.
|
||||
- `npm run dev` - Start the development server
|
||||
- `npm run build` - Build the application
|
||||
- `npm run preview` - Preview the built application
|
||||
- `npm run check-types` - Check TypeScript types
|
||||
|
||||
## Learn More
|
||||
## Project Structure
|
||||
|
||||
To learn more about Next.js, take a look at the following resources:
|
||||
```
|
||||
src/
|
||||
├── components/ # UI components
|
||||
├── lib/ # Utilities and shared code
|
||||
├── types/ # TypeScript type definitions
|
||||
├── App.tsx # Main application component
|
||||
└── index.tsx # Application entry point
|
||||
```
|
||||
|
||||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
||||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
||||
## Components
|
||||
|
||||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
|
||||
- `LoginForm`: User login form
|
||||
- `RegisterForm`: User registration form
|
||||
- `RoomList`: List of available chat rooms
|
||||
- `ChatRoom`: Chat room with messages
|
||||
- `CreateRoom`: Form to create a new chat room
|
||||
|
||||
## Deploy on Vercel
|
||||
## GraphQL Client
|
||||
|
||||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
||||
The application uses URQL as the GraphQL client with subscription support. The client is configured in `src/lib/graphql-client.ts`.
|
||||
|
||||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
|
||||
## Authentication
|
||||
|
||||
Authentication is handled using a simple token-based approach. The token is stored in localStorage and included in GraphQL requests.
|
||||
|
||||
```bash
|
||||
$ npm install # or pnpm install or yarn install
|
||||
```
|
||||
|
||||
### Learn more on the [Solid Website](https://solidjs.com) and come chat with us on our [Discord](https://discord.com/invite/solidjs)
|
||||
|
||||
## Available Scripts
|
||||
|
||||
In the project directory, you can run:
|
||||
|
||||
### `npm run dev`
|
||||
|
||||
Runs the app in the development mode.<br>
|
||||
Open [http://localhost:5173](http://localhost:5173) to view it in the browser.
|
||||
|
||||
### `npm run build`
|
||||
|
||||
Builds the app for production to the `dist` folder.<br>
|
||||
It correctly bundles Solid in production mode and optimizes the build for the best performance.
|
||||
|
||||
The build is minified and the filenames include the hashes.<br>
|
||||
Your app is ready to be deployed!
|
||||
|
||||
## Deployment
|
||||
|
||||
Learn more about deploying your application with the [documentations](https://vite.dev/guide/static-deploy.html)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue