Dự án gồm 3 thành phần chính: Backend (ASP.NET Core), Frontend (React), và Database (PostgreSQL chạy qua Docker).
| Thành phần | Công nghệ | Phiên bản |
|---|---|---|
| Backend | ASP.NET Core | .NET 10 |
| Backend | Entity Framework Core | 10.0.5 |
| Backend | Npgsql (PostgreSQL driver) | 10.0.1 |
| Backend | SignalR | 10.0.5 |
| Backend | JWT Bearer Auth | 10.0.5 |
| Backend | Swagger UI | 10.1.7 |
| Frontend | React | 19 |
| Frontend | TypeScript | 5.9 |
| Frontend | Vite | 8 |
| Frontend | Redux Toolkit | 2.x |
| Frontend | React Router | 7.x |
| Frontend | TailwindCSS | 4.x |
| Database | PostgreSQL | 16 (Alpine) |
instory/
├── backend/ # ASP.NET Core API
│ ├── appsettings.json
│ ├── appsettings.Development.json
│ └── ...
├── frontend/ # React App
│ ├── .env
│ └── ...
└── docker-compose.yml
Nếu máy bạn chưa cài các công cụ dưới đây, hãy làm theo hướng dẫn tương ứng với hệ điều hành của mình.
Docker dùng để chạy database PostgreSQL mà không cần cài thủ công.
- Windows / macOS: Tải và cài tại https://www.docker.com/products/docker-desktop
- Sau khi cài xong, mở ứng dụng Docker Desktop và chờ icon Docker ở thanh taskbar chuyển sang trạng thái "Running" trước khi tiếp tục.
- Linux (Ubuntu/Debian):
sudo apt update sudo apt install -y docker.io docker-compose-plugin sudo usermod -aG docker $USER # Đăng xuất và đăng nhập lại để áp dụng quyền
Kiểm tra cài đặt thành công:
docker --version
docker compose versionDùng để chạy backend ASP.NET Core.
- Tải tại https://dotnet.microsoft.com/download/dotnet/10.0 → chọn đúng hệ điều hành → cài file
.pkg(macOS) hoặc.exe(Windows)
Kiểm tra:
dotnet --version
# 10.x.xDùng để chạy frontend React (Vite 8 yêu cầu Node.js 22 trở lên).
- Tải tại https://nodejs.org → chọn phiên bản v22 LTS → cài như phần mềm bình thường
Lưu ý: Chọn đúng v22, không chọn bản "Latest" vì có thể chưa ổn định.
Kiểm tra:
node --version
# v22.x.x hoặc cao hơn
npm --versionDùng để tải source code từ GitHub.
- Windows: Tải tại https://git-scm.com/download/win → cài mặc định, không cần thay đổi tuỳ chọn
- macOS: Chạy lệnh
git --versiontrong Terminal, nếu chưa có máy sẽ tự hỏi cài - Linux:
sudo apt install -y git
Mở Terminal (macOS/Linux) hoặc Git Bash (Windows), chạy:
git clone https://github.com/your-org/instory.git
cd instoryThay
your-org/instorybằng đường dẫn repo thực tế trên GitHub.
Database PostgreSQL được chạy qua Docker Compose, cần khởi động trước khi chạy backend.
docker compose up -dKiểm tra container đã chạy:
docker compose ps
# instory_db Up 0.0.0.0:5432->5432/tcpTrong thư mục backend/, tạo file appsettings.Development.json với nội dung sau:
{
"ConnectionStrings": {
"Instory": "Host=localhost;Port=5432;Database=Instory;Username=instory;Password=instory_pass"
},
"JwtSettings": {
"SecretKey": "d8bd321e43d9865b82d37c5d592db1f62631a08552a7616da415f08b2239cb2e",
"Issuer": "Instory",
"Audience": "Instory",
"ExpirationMinutes": 4320,
"RefreshTokenExpirationDays": 7
},
"AWS": {
"AccessKey": "YOUR_AWS_ACCESS_KEY",
"SecretKey": "YOUR_AWS_SECRET_KEY",
"Region": "ap-southeast-1",
"BucketName": "instory-media"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}Lưu ý: Thay
YOUR_AWS_ACCESS_KEYvàYOUR_AWS_SECRET_KEYbằng credentials AWS thực tế nếu cần dùng tính năng upload file. Liên hệ team để lấy giá trị chính xác.
cd backend
dotnet ef database updatecd backend
dotnet runBackend sẽ chạy tại: http://localhost:5174
Trong thư mục frontend/, tạo file .env với nội dung:
API_BASE_URL=http://localhost:5174/apicd frontend
npm install
npm run devFrontend sẽ chạy tại: http://localhost:5173
| Dịch vụ | Địa chỉ |
|---|---|
| Frontend (React) | http://localhost:5173 |
| Backend API (ASP.NET) | http://localhost:5174 |
| PostgreSQL | localhost:5432 |
# Xem log database
docker compose logs -f postgres
# Kết nối trực tiếp vào PostgreSQL
docker compose exec postgres psql -U instory -d Instory
# Dừng database
docker compose stop
# Xoá hoàn toàn database (mất data!)
docker compose down -v1. docker compose up -d → Database sẵn sàng
2. dotnet run (backend/) → API sẵn sàng
3. npm run dev (frontend/) → Giao diện sẵn sàng