Welcome to the DearDiary repository! This project is built with Next.js and uses Clerk for authentication. This guide will walk you through setting up the project and contributing effectively.
We are happy to have you contribute to our project! Follow these steps to set up your local environment and start making contributions.
To get started, you will need:
- Node.js (v16 or later) installed.
- Git for cloning and version control.
- Clerk Account for authentication (you will need API keys).
First, fork this repository by clicking the "Fork" button at the top. Then, clone your forked copy to your local machine:
git clone https://github.com/your-username/DearDiary.git
cd DearDiary
To install all required dependencies, run:
npm install
This command will install Next.js, Clerk, and other necessary libraries.
Setting Up Clerk
-
Sign Up for Clerk: If you haven’t already, sign up at Clerk.dev and create an application.
-
Get API Keys: Once your application is set up, get your Frontend API Key and Secret Key.
-
Add Environment Variables: Create a .env.local file in the root directory:
NEXT_PUBLIC_CLERK_FRONTEND_API=<YOUR_FRONTEND_API_KEY>
CLERK_API_KEY=<YOUR_SECRET_KEY>
Verify Configuration: Double-check that the keys are correctly set up by running:
npm run dev
You should be able to access the application at http://localhost:3000 and see Clerk authentication enabled.
To start the development server, use:
npm run dev
Your local server will be running at http://localhost:3000.
Thank you for pointing that out! Here’s the updated Docker setup instructions section for your README.md
, including the relevant information about the DATABASE_URL
.
To set up the application using Docker, follow these steps:
Ensure that your .env
file contains the below DATABASE_URL
. It should be the this:
DATABASE_URL=postgres://user:password@db:5432/mydatabase
To build the Docker images and start the containers, run the following command:
npm run docker:setup
This command will:
- Build the Docker containers using
docker-compose build
. - Start the containers using
docker-compose up -d
. - Run the Prisma migrations to ensure your database is up to date.
- Open Web App in your browser at
http://localhost:3000
. - Open Prisma Studio for database management in your browser at
http://localhost:5555
.
You can manage the Docker containers with the following commands:
-
Start the containers (if they are stopped):
npm run docker:start
-
Stop the containers (without removing them):
npm run docker:stop
-
Restart the containers:
npm run docker:restart
-
Take down the containers (stop and remove):
npm run docker:down
-
Rebuild the containers without using cache:
npm run docker:build --no-cache
Prisma is used for interacting with your PostgreSQL database. Here are the available Prisma commands:
To apply your Prisma schema and migrate your database, use:
npm run prisma:migrate
This command will run the migrations within the Docker container and update the database schema.
Prisma Studio provides a GUI to explore and edit your database. To open Prisma Studio, run:
npm run prisma:studio
After running the command, open your browser and go to http://localhost:5555
to access Prisma Studio.
If you've updated your Prisma schema and want to push changes to your database without creating migration files, run:
npm run prisma:push
If your database schema has changed and you want to update your Prisma schema, you can pull the changes with:
npm run prisma:pull
To regenerate the Prisma client after making schema changes, use:
npm run prisma:generate
This command is automatically run on production during the postinstall
phase if the environment is not set to development
.
We follow some simple guidelines to ensure a smooth collaboration process.
If you find a bug or have an idea for an enhancement:
-
Check Existing Issues: Look at open issues to see if your issue already exists.
-
Create a New Issue: If not, open a new issue, providing as much detail as possible.
-
Get Assigned: Comment on an issue you'd like to work on and wait to be assigned.
-
Create a New Branch: For each feature or bug fix, create a new branch:
git checkout -b feature/issue-name
- Push Your Branch: Once you’ve made your changes and tested them:
git push origin feature/issue-name
-
Create a Pull Request (PR): Go to the GitHub repository and click on "New Pull Request." Make sure to provide a clear description of what you did and why.
-
Review and Update: Your PR may get reviewed by the maintainers. Be ready to make suggested changes.
This project is open-source. Feel free to use it!
Feel free to modify any part of the text to better suit your project!
- Review Comments: Project maintainers may review your code and suggest improvements.
- Make Updates: Update your changes accordingly, and push them to the same branch. The PR will update automatically.
Once your PR is merged, you’ve officially made your first contribution!