90 lines
1.9 KiB
Markdown
90 lines
1.9 KiB
Markdown
# Xtablo API
|
|
|
|
This is the backend API for Xtablo, built with [Hono](https://hono.dev/) and TypeScript.
|
|
|
|
## Development
|
|
|
|
This package is part of the Xtablo monorepo managed with Turborepo and pnpm workspaces.
|
|
|
|
### Prerequisites
|
|
|
|
- Node.js >= 20.0.0
|
|
- pnpm 10.x
|
|
|
|
### Available Commands
|
|
|
|
From the root of the monorepo:
|
|
|
|
```bash
|
|
# Start development server
|
|
pnpm run dev:api
|
|
|
|
# Build the API
|
|
turbo run build --filter=@xtablo/api
|
|
|
|
# Run tests
|
|
pnpm run test:api
|
|
|
|
# Type checking
|
|
turbo run typecheck --filter=@xtablo/api
|
|
|
|
# Linting
|
|
turbo run lint --filter=@xtablo/api
|
|
turbo run lint:fix --filter=@xtablo/api
|
|
|
|
# Format code
|
|
turbo run format --filter=@xtablo/api
|
|
```
|
|
|
|
From within the `apps/api` directory:
|
|
|
|
```bash
|
|
# Start development server
|
|
pnpm dev
|
|
|
|
# Build
|
|
pnpm build
|
|
|
|
# Start production server
|
|
pnpm start
|
|
|
|
# Run tests
|
|
pnpm test
|
|
pnpm test:watch
|
|
|
|
# Linting and formatting
|
|
pnpm lint
|
|
pnpm lint:fix
|
|
pnpm format
|
|
```
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
apps/api/
|
|
├── src/
|
|
│ ├── __tests__/ # Test files
|
|
│ ├── helpers/ # Helper functions
|
|
│ ├── middlewares/ # Hono middlewares
|
|
│ ├── routers/ # API route handlers
|
|
│ ├── types/ # TypeScript type definitions
|
|
│ ├── config.ts # Configuration
|
|
│ ├── index.ts # Entry point
|
|
│ └── secrets.ts # Secret management
|
|
├── dist/ # Compiled output
|
|
├── docs/ # API documentation
|
|
├── examples/ # Usage examples
|
|
├── Dockerfile # Docker configuration
|
|
├── cloudbuild.yaml # Google Cloud Build config
|
|
├── package.json
|
|
├── tsconfig.json
|
|
└── turbo.json # Turborepo config
|
|
```
|
|
|
|
## Environment Variables
|
|
|
|
See `.env.example` for required environment variables.
|
|
|
|
## Deployment
|
|
|
|
The API is deployed to Google Cloud Run. See `cloudbuild.yaml` for deployment configuration.
|