This project is a Next.js application initialized with create-next-app
and using Prisma for database management. It also integrates shadcn for UI components and Better Auth for authentication.
This project aims to provide a SaaS platform with workspace creation, enabling a file manager system. Future features will include chat functionality and a calendar system to enhance collaboration within workspaces.
Before starting, make sure you have the following tools installed on your machine:
- Node.js
- PostgreSQL or another database supported by Prisma
- Prisma CLI
- Docker & Docker Compose
Clone the repository and install dependencies:
pnpm install
# or
npm install
# or
yarn install
Copy the .env.example
file to .env
and configure the environment variables:
DATABASE_URL="postgresql://USER:PASSWORD@HOST:PORT/DATABASE"
FOLDER_DATA=data
BETTER_AUTH_SECRET=..... # openssl rand -base64 32
GROQ_API_KEY=.......
Generate the Prisma client and apply migrations:
npx prisma generate
npx prisma migrate dev --name init
Before running the development server, make sure to seed the database with initial data:
npx prisma db seed
If you need to reset the database and apply the seeders again:
npx prisma migrate reset
npx prisma db seed
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 in your browser to see the result.
The project includes a seed script to populate the database with test data. Modify the src/lib/prisma/seeds/seed.ts
file as needed.
Run the seed script:
npx prisma db seed
To run the project in a production environment using Docker, use the provided docker-compose.yml
file.
docker-compose up -d --build
docker-compose down
Below is the docker-compose.yml
configuration used for running the application in production:
services:
db:
image: postgres:15.6
container_name: collab-nextjs-db
ports:
- "5432:5432"
environment:
- POSTGRES_DB=collab
- POSTGRES_USER=collab
- POSTGRES_PASSWORD=collab
volumes:
- collab_nextjs_db:/var/lib/postgresql/data
app:
container_name: collab-nextjs
build:
context: .
dockerfile: Dockerfile
args:
- FOLDER_DATA
environment:
- DATABASE_URL=postgresql://collab:collab@db:5432/collab?schema=public
restart: unless-stopped
ports:
- "3000:3000"
depends_on:
- db
volumes:
- collab_nextjs_data:/app/${FOLDER_DATA}
volumes:
collab_nextjs_db:
collab_nextjs_data:
This project uses pnpm
as the package manager in the Dockerfile. If you prefer to use npm
or yarn
, make sure to update the Dockerfile accordingly to replace pnpm
commands with the package manager of your choice.
The easiest way to deploy your application is by using Vercel.
Check out the Next.js deployment documentation for more details.
Happy coding! 🚀