Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
chore(sys): update readme & add license
Browse files Browse the repository at this point in the history
  • Loading branch information
Thdeathz committed Dec 28, 2023
1 parent 77d83e4 commit 317320f
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 60 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 CnWeb Team - Group 10

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ devinstall:
prisma-format:
docker exec -it $(COMPOSE_PROJECT_NAME)-server-1 yarn prisma format

prisma-generate:
docker exec -it $(COMPOSE_PROJECT_NAME)-server-1 yarn prisma generate

prisma-migrate:
docker exec -it $(COMPOSE_PROJECT_NAME)-server-1 yarn prisma migrate dev --name init --create-only

Expand Down
97 changes: 37 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,100 +1,77 @@
# MERN project starter template (Typescript)
# KanjiGami

This is a MERN (MongoDB, Express, React, Node.js) project starter template that uses Typescript.
Website luyện tập tiếng nhật thông qua game

## Features
## Giới thiệu

- MERN stack with Typescript
- Tailwind CSS and Ant Design for UI design
- Redux Toolkit and RTK Query for state management
- Base 2 JWT token authentication
- Login with Google using Firebase Authentication
- [Yêu cầu hệ thống](#Yêu-cầu-hệ-thống)
- [Hướng dẫn chạy dự án](#setup-and-configuration)
- [Các chức năng](#usage)
- [License](#license)

## Requirement
## Yêu cầu hệ thống

- Docker >= 20.10
- Docker compose plugin
- NodeJS 18

## How to use it
## Hướng dẫn chạy dự án

Run the following command in the root directory of project:
Sau khi clone project thực hiện những bước sau:

1. Khởi động docker container:

```bash
make devup
```

This will create a `.env` file in the root directory. You can configure environment variables in this file according to your needs.

Install dependencies:
2. Cài đặt các package cần thiết:

```bash
make devinstall
```

Add secret key for JWT token:

```bash
make genkey
```

Replace the results obtained with the following values in the `server/.env`:

```bash
ACCESS_TOKEN_SECRET=<your access token secret>
REFRESH_TOKEN_SECRET=<your refresh token secret>
```

Deploy database:
3. Tạo database:

```bash
make prisma-generate
make prisma-deploy
make prisma-seed
```

Set up a Firebase project and configure the necessary environment variables:
4. Tạo một dự án firebase và thêm các thông tin cấu hình tướng ứng vào 2 file: `./client/.env``./server/.env`

1. Create a Firebase project at [https://console.firebase.google.com](https://console.firebase.google.com)
2. Enable the `Authentication`, `Storage` for the project
3. Obtain the Firebase configuration values (API key, database URL, etc.)
4. Add the following environment variables to the `.env` file at `client`:
5. Lấy gmail app key và thêm vào file `./server/.env`

```bash
VITE_FIREBASE_APP_ID=
VITE_FIREBASE_API_KEY=
VITE_FIREBASE_AUTH_DOMAIN=
VITE_FIREBASE_PROJECT_ID=
VITE_FIREBASE_STORAGE_BUCKET=
VITE_FIREBASE_MESSAGE_SENDER_ID=
VITE_FIREBASE_MEASUREMENT_ID=
```

5. Generate a private key file for your service account: `Settings > Service Accounts > Generate New Private Key`
6. Add the following environment variables to the `.env` file at `server`:
6. Tạo private key cho jwt và thêm vào file `./server/.env` bằng câu lệnh:

```bash
FIREBASE_PROJECT_ID=
FIREBASE_PRIVATE_KEY_ID=
FIREBASE_PRIVATE_KEY=
FIREBASE_CLIENT_EMAIL=
FIREBASE_CLIENT_ID=
FIREBASE_AUTH_URI=
FIREBASE_TOKEN_URI=
FIREBASE_AUTH_PROVIDER_X509_CERT_URL=
FIREBASE_CLIENT_X509_CERT_URL=
make genkey
```

Start the app in the development mode:
6. Chạy dự án:

```bash
make devrun
```

The app will run by default at `project.localhost:3000`, and you can custom it in the `.env` file in the root directory.
## Các chức năng

Stop the application:
1. Cấu trúc thư mục:

```bash
make devdown
```
├── .github # Github actions
├── client # Frontend
├── deploy # Deploy Dockerfile
└── server # Backend
```

2. Domain truy cập:

- Client: [http://kanjigami.localhost:3000](http://kanjigami.localhost:3000)
- Server: [http://kanjigami.localhost:3000/api/](http://kanjigami.localhost:3000/api/)
- Traefik: [http://traefik.localhost:3000](http://traefik.localhost:3000)

## License

Happy coding ><
This project is licensed under the [MIT License](LICENSE).

0 comments on commit 317320f

Please sign in to comment.