This is a Next.js project with Directus as a headless CMS and Auth0 for authentication.
- Node.js 18+ or Bun 1.0+
- Docker and Docker Compose (for Directus and containerized deployment)
- Auth0 account with configured application
- Git
-
Copy
.env.exampleto.env:cp .env.example .env
-
Update the
.envfile with your configuration:
- Generate secure keys and tokens as indicated in the comments
- Configure Auth0 credentials
- Set appropriate URLs for your environment
Run Directus in Docker and Next.js locally:
# Start Directus
docker-compose -f docker-compose.directus.yml up -d
# Install dependencies
bun install
# Start Next.js development server
bun run devAccess:
- Next.js: http://localhost:3000
- Directus: http://localhost:8355
Run both Directus and Next.js in Docker:
docker-compose up -dAccess:
- Next.js: http://localhost:3300
- Directus: http://localhost:8355
-
Deploy Directus:
docker-compose -f docker-compose.directus.yml up -d
-
Deploy Next.js to your preferred platform (Vercel, etc.)
- Set environment variables in your deployment platform
- Ensure
NEXT_PUBLIC_DIRECTUS_URLpoints to your Directus instance
Use the production configuration:
# Uncomment the web-prod service in docker-compose.yml first
docker-compose up -d/src- Next.js application source/app- App router pages and API routes/components- React components/lib- Utility functions and configurations
# Development
bun run dev # Start development server
# Production
bun run build # Build for production
bun run start # Start production server
# Linting
bun run lint # Run ESLint- For production, ensure all environment variables are properly set
- Configure CORS in Directus for your production domains
- Set up proper SSL/TLS for both Directus and Next.js
- Consider using a reverse proxy (e.g., Nginx) in production
- Backup your Directus database and uploads regularly