89 lines
1.7 KiB
Markdown
89 lines
1.7 KiB
Markdown
# LK API Template
|
|
|
|
A modern, production-ready API template built with Go and React, featuring comprehensive authentication, mailing capabilities, and automatic API documentation.
|
|
|
|
## 🚀 Features
|
|
|
|
- **Backend (Go)**
|
|
|
|
- Chi router for efficient HTTP routing
|
|
- Swagger/OpenAPI documentation
|
|
- SendGrid integration for email notifications
|
|
- Rate limiting support
|
|
- Redis caching
|
|
- PostgreSQL database integration
|
|
- JWT-based authentication
|
|
- Environment-based configuration
|
|
- Structured logging with Zap
|
|
- Hot reload support with Air
|
|
|
|
- **Frontend (React + TypeScript)**
|
|
- Vite for fast development and building
|
|
- TypeScript support
|
|
- ESLint configuration for code quality
|
|
- Hot Module Replacement (HMR)
|
|
|
|
## 📋 Prerequisites
|
|
|
|
- Go 1.21 or higher
|
|
- Node.js 18 or higher
|
|
- PostgreSQL
|
|
- Redis
|
|
- SendGrid API key (for email functionality)
|
|
|
|
## 🛠️ Installation
|
|
|
|
1. Clone the repository:
|
|
|
|
```bash
|
|
git clone https://github.com/yourusername/lk-api-template.git
|
|
cd lk-api-template
|
|
```
|
|
|
|
2. Install backend dependencies:
|
|
|
|
```bash
|
|
go mod download
|
|
```
|
|
|
|
3. Install frontend dependencies:
|
|
|
|
```bash
|
|
cd web
|
|
npm install
|
|
```
|
|
|
|
4. Set up environment variables:
|
|
|
|
```bash
|
|
cp .env.example .env
|
|
# Edit .env with your configuration
|
|
```
|
|
|
|
## 🚀 Development
|
|
|
|
### Backend
|
|
|
|
Run the backend server with hot reload:
|
|
|
|
```bash
|
|
air
|
|
```
|
|
|
|
The API will be available at `http://localhost:8080` with the base path `/v1`.
|
|
|
|
### Frontend
|
|
|
|
Run the frontend development server:
|
|
|
|
```bash
|
|
cd web
|
|
npm run dev
|
|
```
|
|
|
|
The frontend will be available at `http://localhost:5173`.
|
|
|
|
## 📚 API Documentation
|
|
|
|
The API documentation is automatically generated using Swagger. Once the server is running, you can access the Swagger UI at:
|