Files
lumina-nextjs-template/README.md
2025-12-23 04:19:57 +01:00

263 lines
6.1 KiB
Markdown

# asd
ads
## Tech Stack
- **Framework:** Next.js 15 (App Router)
- **Language:** TypeScript
- **Styling:** Tailwind CSS
- **UI Components:** Spartan UI
- **Database & Auth:** Supabase
- **Code Quality:** ESLint + Prettier
## Getting Started
### Prerequisites
- Node.js 20 or higher
- pnpm 8 or higher (recommended) or npm
### Installation
```bash
# Install dependencies
pnpm install
# Copy environment variables
cp .env.example .env.local
# Update .env.local with your Supabase credentials
```
### Development
```bash
# Run development server
pnpm dev
# Open http://localhost:3000
```
### Build
```bash
# Create production build
pnpm build
# Start production server
pnpm start
```
## Project Structure
```
project-1766459980010-q6lr8s01b/
├── app/ # Next.js app router pages
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Homepage
│ └── globals.css # Global styles
├── components/ # React components
│ └── ui/ # UI components
├── lib/ # Utility functions
│ ├── supabase.ts # Supabase client
│ └── utils.ts # Helper functions
├── public/ # Static assets
└── ...config files
```
## Environment Variables
Create a `.env.local` file with:
```env
NEXT_PUBLIC_SUPABASE_URL=your-supabase-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key
```
## Scripts
- `pnpm dev` - Start development server
- `pnpm build` - Create production build
- `pnpm start` - Start production server
- `pnpm lint` - Run ESLint
- `pnpm format` - Format code with Prettier
## Deployment
This template comes with production-ready Docker and Kubernetes configurations.
### Docker Deployment
#### Build Docker Image
```bash
# Build the image
docker build -t lumina-app:latest .
# Run locally
docker run -p 3000:3000 --env-file .env.local lumina-app:latest
```
#### Docker Compose (Recommended for local testing)
```bash
# Start all services (app + postgres + redis)
docker-compose up -d
# View logs
docker-compose logs -f app
# Stop services
docker-compose down
```
#### Push to Harbor Registry
```bash
# Tag image for Harbor
docker tag lumina-app:latest harbor.advisori.de/lumina/project-1766459980010-q6lr8s01b:latest
# Login to Harbor
docker login harbor.advisori.de
# Push image
docker push harbor.advisori.de/lumina/project-1766459980010-q6lr8s01b:latest
```
### Kubernetes Deployment
#### Prerequisites
- Kubernetes cluster (1.25+)
- kubectl configured
- Helm 3.x installed
- Harbor registry access
#### Deploy with Helm
```bash
# Navigate to helm chart
cd helm/lumina-app
# Create namespace
kubectl create namespace lumina-apps
# Create Harbor pull secret
kubectl create secret docker-registry harbor-registry-secret \
--docker-server=harbor.advisori.de \
--docker-username=your-username \
--docker-password=your-password \
--namespace=lumina-apps
# Create application secrets
kubectl create secret generic lumina-app-secrets \
--from-literal=DATABASE_URL="your-database-url" \
--from-literal=SUPABASE_URL="your-supabase-url" \
--from-literal=SUPABASE_ANON_KEY="your-anon-key" \
--namespace=lumina-apps
# Install/Upgrade with Helm
helm upgrade --install project-1766459980010-q6lr8s01b . \
--namespace lumina-apps \
--set image.repository=harbor.advisori.de/lumina/project-1766459980010-q6lr8s01b \
--set image.tag=latest \
--set ingress.hosts[0].host=project-1766459980010-q6lr8s01b.advisori.de \
--set ingress.tls[0].hosts[0]=project-1766459980010-q6lr8s01b.advisori.de
```
#### Customize Deployment
Edit `helm/lumina-app/values.yaml` to customize:
- **Replicas**: Number of pods (default: 2)
- **Resources**: CPU/Memory limits
- **Autoscaling**: Min/Max replicas and thresholds
- **Ingress**: Domain and TLS settings
- **Environment**: Add custom env variables
- **Persistence**: Enable persistent storage
#### Monitor Deployment
```bash
# Check pods
kubectl get pods -n lumina-apps
# View logs
kubectl logs -f deployment/project-1766459980010-q6lr8s01b -n lumina-apps
# Check ingress
kubectl get ingress -n lumina-apps
# Port forward for testing
kubectl port-forward svc/project-1766459980010-q6lr8s01b 3000:80 -n lumina-apps
```
#### Scaling
```bash
# Manual scaling
kubectl scale deployment project-1766459980010-q6lr8s01b --replicas=5 -n lumina-apps
# Horizontal Pod Autoscaler (enabled by default)
kubectl get hpa -n lumina-apps
```
#### Update Deployment
```bash
# Build and push new image
docker build -t harbor.advisori.de/lumina/project-1766459980010-q6lr8s01b:v1.1.0 .
docker push harbor.advisori.de/lumina/project-1766459980010-q6lr8s01b:v1.1.0
# Update with new image
helm upgrade project-1766459980010-q6lr8s01b ./helm/lumina-app \
--namespace lumina-apps \
--set image.tag=v1.1.0 \
--reuse-values
# Rollback if needed
helm rollback project-1766459980010-q6lr8s01b -n lumina-apps
```
### CI/CD Integration
The template includes configurations for automated deployments:
- **Gitea Actions**: Auto-build on push to main
- **Harbor Webhook**: Trigger K8s deployment on new image
- **Helm Chart**: Version-controlled infrastructure
### Health Checks
The application exposes a health endpoint at `/api/health` for:
- Kubernetes liveness probes
- Readiness probes
- Load balancer health checks
Create `app/api/health/route.ts` if not exists:
```typescript
export async function GET() {
return Response.json({ status: 'healthy' }, { status: 200 });
}
```
## Learn More
- [Next.js Documentation](https://nextjs.org/docs)
- [Supabase Documentation](https://supabase.com/docs)
- [Spartan UI Documentation](https://www.spartan.ng/)
- [Tailwind CSS Documentation](https://tailwindcss.com/docs)
- [Kubernetes Documentation](https://kubernetes.io/docs)
- [Helm Documentation](https://helm.sh/docs)
## License
MIT
---
**Generated by Lumina** - AI-Powered Development Platform by [advisori](https://advisori.de)