Skip to content

Commit

Permalink
Merge branch 'main' into ogtag
Browse files Browse the repository at this point in the history
  • Loading branch information
akankshagoel28 authored Oct 26, 2024
2 parents 59311fe + a75d36e commit 6822080
Show file tree
Hide file tree
Showing 44 changed files with 1,897 additions and 153 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
.next/
.env
.env.local
17 changes: 17 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: PR Comment

on:
pull_request:
types: [opened]

jobs:
add_comment:
runs-on: ubuntu-latest

steps:
- name: Add a "Thank you" comment to new PR
uses: actions-ecosystem/action-add-comment@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
issue_number: ${{ github.event.pull_request.number }}
comment: '🎉 Thank you for your contribution! Your pull request has been submitted successfully. A maintainer from DearDiary team will review it as soon as possible. We appreciate your support in making this project better.'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ yarn-error.log*

# local env files
.env*.local
.env.example

# vercel
.vercel
Expand Down
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use an official Node.js image as the base image
FROM node:18-alpine

# Set the working directory
WORKDIR /app

# Copy package.json and package-lock.json first
COPY package*.json ./

# Set NODE_ENV to development for the build process
ENV NODE_ENV=development

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY . .

# Expose the Next.js default port
EXPOSE 3000

# Start the Next.js app
CMD ["npm", "run", "dev"]
171 changes: 156 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,28 @@

Welcome to the **[DearDiary](https://github.com/TenzDelek/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.

## Featured In

<table>
<tr>
<th>Event Logo</th>
<th>Event Name</th>
<th>Event Description</th>
</tr>
<tr>
<td><img src="https://user-images.githubusercontent.com/63473496/213306279-338f7ce9-9a9f-4427-8c2a-3e344874498f.png#gh-dark-mode-only" width="200" height="auto" loading="lazy" alt="GSSoC Ext 24"/></td>
<td>GirlScript Summer of Code Ext 2024</td>
<td>GSSOC Ext is a one-month-long open-source program by the GirlScript Foundation that runs from October 1 to November 10, 2024</td>
</tr>
<tr>
<td><img src="https://cdn.prod.website-files.com/63bc83b29094ec80844b6dd5/66fc35d92c74c4e4103f3673_Flyte-at-Hacktoberfest-2024.png" width="200" height="auto" loading="lazy" alt="Hacktoberfest 24"/></td>
<td>Hacktoberfest 2024</td>
<td>Hacktober Fest is an annual celebration of open-source software development. It's a month-long event encouraging developers to contribute to open-source projects.</td>
</tr>
</table>

## Table of Contents

- [Getting Started](#getting-started)
- [Project Setup](#project-setup)
- [Prerequisites](#prerequisites)
Expand Down Expand Up @@ -47,6 +68,7 @@ cd DearDiary
```

### Installing Dependencies

To install all required dependencies, run:

```bash
Expand All @@ -58,11 +80,11 @@ 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](https://clerk.dev/) and create an application.
- Sign Up for Clerk: If you haven’t already, sign up at [Clerk.dev](https://clerk.dev/) and create an application.

* Get API Keys: Once your application is set up, get your Frontend API Key and Secret Key.
- 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:
- Add Environment Variables: Create a .env.local file in the root directory:

```env
NEXT_PUBLIC_CLERK_FRONTEND_API=<YOUR_FRONTEND_API_KEY>
Expand All @@ -77,16 +99,135 @@ npm run dev

You should be able to access the application at http://localhost:3000 and see Clerk authentication enabled.


### Running the Project

To start the development server, use:

```bash
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`.

---

## Docker Setup Instructions

To set up the application using Docker, follow these steps:

### 1. **Configure the Database URL**

Ensure that your `.env` file contains the below `DATABASE_URL`. It should be the this:

```plaintext
DATABASE_URL=postgres://user:password@db:5432/mydatabase
```

### 2. **Build and Start Docker Containers**

To build the Docker images and start the containers, run the following command:

```bash
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`.

### 3. **Managing Docker Containers**

You can manage the Docker containers with the following commands:

- **Start the containers** (if they are stopped):

```bash
npm run docker:start
```

- **Stop the containers** (without removing them):

```bash
npm run docker:stop
```

- **Restart the containers**:

```bash
npm run docker:restart
```

- **Take down the containers** (stop and remove):

```bash
npm run docker:down
```

- **Rebuild the containers without using cache**:
```bash
npm run docker:build --no-cache
```

---

## Prisma Commands

Prisma is used for interacting with your PostgreSQL database. Here are the available Prisma commands:

### 1. **Run Migrations**

To apply your Prisma schema and migrate your database, use:

```bash
npm run prisma:migrate
```

This command will run the migrations within the Docker container and update the database schema.

### 2. **Open Prisma Studio**

Prisma Studio provides a GUI to explore and edit your database. To open Prisma Studio, run:

```bash
npm run prisma:studio
```

After running the command, open your browser and go to `http://localhost:5555` to access Prisma Studio.

### 3. **Push Prisma Schema to Database**

If you've updated your Prisma schema and want to push changes to your database without creating migration files, run:

```bash
npm run prisma:push
```

### 4. **Pull Database Schema into Prisma**

If your database schema has changed and you want to update your Prisma schema, you can pull the changes with:

```bash
npm run prisma:pull
```

### 5. **Generate Prisma Client**

To regenerate the Prisma client after making schema changes, use:

```bash
npm run prisma:generate
```

This command is automatically run on production during the `postinstall` phase if the environment is not set to `development`.

---

# Basic Contribution Guidelines

We follow some simple guidelines to ensure a smooth collaboration process.
Expand All @@ -95,50 +236,50 @@ 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](https://github.com/your-username/[DearDiary](https://github.com/TenzDelek/DearDiary)/issues) to see if your issue already exists.
- Check Existing Issues: Look at [open issues](<https://github.com/your-username/[DearDiary](https://github.com/TenzDelek/DearDiary)/issues>) to see if your issue already exists.

* Create a New Issue: If not, open a new issue, providing as much detail as possible.
- Create a New Issue: If not, open a new issue, providing as much detail as possible.

## Working on Issues

* Get Assigned: Comment on an issue you'd like to work on and wait to be assigned.
- 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:
- Create a New Branch: For each feature or bug fix, create a new branch:

```bash
git checkout -b feature/issue-name
```

## Submitting a Pull Request
* Push Your Branch: Once you’ve made your changes and tested them:

- Push Your Branch: Once you’ve made your changes and tested them:

```bash
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.
- 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.
- Review and Update: Your PR may get reviewed by the maintainers. Be ready to make suggested changes.

### License

This project is open-source. Feel free to use it!

```vbnet

Feel free to modify any part of the text to better suit your project!
```


### Respond to Feedback

* 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.
- 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.

# Celebrate Your Contribution!

Once your PR is merged, you’ve officially made your first contribution!


## Our Valuable Contributors ❤️✨

[![Contributors](https://contrib.rocks/image?repo=TenzDelek/DearDiary)](https://github.com/TenzDelek/DearDiary/graphs/contributors)
31 changes: 31 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: "3.8"
services:
app:
build:
context: .
dockerfile: Dockerfile
args:
DATABASE_URL: ${DATABASE_URL}
ports:
- "3000:3000"
- "5555:5555" # Forward Prisma Studio port to host machine

env_file:
- .env # Load environment variables from .env
depends_on:
- db

db:
image: postgres:14-alpine
restart: always
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: mydatabase
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data

volumes:
postgres_data:
3 changes: 2 additions & 1 deletion jsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"jsx": "react",
"paths": {
"@/*": ["./src/*"]
}
}
}
}
18 changes: 15 additions & 3 deletions next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
/** @type {import('next').NextConfig} */
const nextConfig = {};
// next.config.mjs

export default nextConfig;
/** @type {import('next').NextConfig} */
const nextConfig = {
async rewrites() {
return [
{
source: '/api/quote',
destination: 'https://zenquotes.io/api/random',
},
]
},
}

export default nextConfig;

Loading

0 comments on commit 6822080

Please sign in to comment.