Create a .env.local file in the root of your project with the following content:
# PostgreSQL Database Connection
DATABASE_URL="postgresql://postgres:password@localhost:5432/brisk_db?schema=public"
# NextAuth Secret
NEXTAUTH_SECRET="your-secret-key-here"
NEXTAUTH_URL="http://localhost:3000"
# OAuth Providers
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"
TWITTER_CLIENT_ID="your-twitter-client-id"
TWITTER_CLIENT_SECRET="your-twitter-client-secret"
APPLE_CLIENT_ID="your-apple-client-id"
APPLE_CLIENT_SECRET="your-apple-client-secret"
Replace the values with your actual PostgreSQL connection details and OAuth provider credentials.
Create a new PostgreSQL database named brisk_db:
createdb brisk_db
# Or use pgAdmin or another PostgreSQL management toolRun the following command to create the database tables based on your Prisma schema:
npx prisma migrate dev --name initThis will:
- Create a new migration based on your schema changes
- Apply the migration to your database
- Generate the Prisma client based on your new schema
Run the following command to open Prisma Studio and verify your database tables:
npx prisma studioThis will open a browser window where you can view and manage your database records.
The database integration is now set up with the following features:
-
User Authentication: NextAuth and Prisma will handle user authentication, including accounts, sessions, and verification tokens.
-
Projects Management: The database includes a Project model that stores user projects with their components and connections.
-
Meeting Scheduler: The Meeting model stores information about scheduled meetings for the QuantumTalk feature.
-
User Status Tracking: The User model includes status and lastActive fields for tracking online status.
For production deployment, consider these additional steps:
- Use environment variables for all sensitive information
- Set up a production database with proper security measures
- Configure database connection pooling for better performance
- Set up database backups and monitoring
Remember to never commit your .env.local file to version control!