From 4e5b8430ecf1ead7404a778cd62e7d5453eb6b18 Mon Sep 17 00:00:00 2001 From: schererleander Date: Wed, 2 Jul 2025 22:36:24 +0200 Subject: docs: update README for generic boilerplate setup --- README.md | 103 ++++++++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 81 insertions(+), 22 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index e215bc4..0213e23 100644 --- a/README.md +++ b/README.md @@ -1,36 +1,95 @@ -This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app). +# Nextjs-Boilerplate -## Getting Started +A Next.js application with user authentication, profile management, and file storage capabilities. -First, run the development server: +## Prerequisites -```bash -npm run dev -# or -yarn dev -# or -pnpm dev -# or -bun dev +- Node.js 18+ +- Docker and Docker Compose +- npm/yarn/pnpm + +## Environment Variables + +Create a `.env` file in the root directory with the following variables: + +```env +# MongoDB +MONGO_INITDB_ROOT_USERNAME=admin +MONGO_INITDB_ROOT_PASSWORD=your-mongodb-password +MONGO_INITDB_DATABASE=your-database-name +MONGO_ENDPOINT_HOST=localhost +MONGO_ENDPOINT_PORT=27017 +MONGODB_URI="mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@${MONGO_ENDPOINT_HOST}:${MONGO_ENDPOINT_PORT}/${MONGO_INITDB_DATABASE}?authSource=admin" + +# MinIO Object Storage +MINIO_ROOT_USER=admin +MINIO_ROOT_PASSWORD=your-minio-password +MINIO_ENDPOINT_HOST=localhost +MINIO_ENDPOINT_PORT=9000 +MINIO_ACCESS_KEY=${MINIO_ROOT_USER} +MINIO_SECRET_KEY=${MINIO_ROOT_PASSWORD} + +# NextAuth +NEXTAUTH_SECRET=your-secret-key-here +NEXTAUTH_URL=localhost:3000 ``` -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. +## Quick Start + +1. **Clone and install dependencies:** + ```bash + npm install + ``` -You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. +2. **Start the database and storage services:** + ```bash + docker-compose up -d + ``` -This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel. +3. **Run the development server:** + ```bash + npm run dev + ``` -## Learn More +4. **Access the application:** + - App: http://localhost:3000 + - MinIO Web Interface: http://localhost:9001 -To learn more about Next.js, take a look at the following resources: +## Database Setup -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. +### MongoDB +- **Container**: MongoDB 7.0 with authentication +- **Port**: 27017 +- **Database**: `MONGO_INITDB_DATABASE` +- **Admin User**: Set via `MONGO_INITDB_ROOT_USERNAME` and `MONGO_INITDB_ROOT_PASSWORD` -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome! +The MongoDB instance will automatically create the specified database and user on first startup. -## Deploy on Vercel +## Storage Setup + +### MinIO Object Storage +- **Container**: MinIO latest with web console +- **API Port**: 9000 +- **Console Port**: 9001 +- **Bucket**: `storage` (auto-created) +- **Access**: Set via `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` + +## Development + +```bash +# Start services +docker-compose up -d + +# Run development server +npm run dev + +# Stop services +docker-compose down +``` -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. +## Production Deployment -Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details. +Update the following environment variables for production: +- Set `NEXTAUTH_URL` to your domain +- Use strong passwords for database and storage +- Configure SSL for MinIO (`useSSL: true` in MinIO client) -- cgit v1.3.1