Skip to content

Commit

Permalink
Merge branch 'main' into Feat/SearchWithLabelsInQuestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Zafeeruddin authored Oct 5, 2024
2 parents 2e363af + 01a09fd commit 7cee996
Show file tree
Hide file tree
Showing 60 changed files with 1,052 additions and 693 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ jobs:
- name: Checkout the Repository
uses: actions/checkout@v3

- name: Setup pnpm
run: npm install -g pnpm

- name: Install Dependencies
run: pnpm install --legacy-peer-deps
run: pnpm install

- name: Run linting check
run: pnpm run lint:check
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/.pnp
.pnp.js
.yarn/install-state.gz
bun.lockb

# docker volume
/postgres-data/
Expand Down
4 changes: 0 additions & 4 deletions .husky/post-merge

This file was deleted.

12 changes: 0 additions & 12 deletions .husky/pre-commit

This file was deleted.

1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy-peer-deps = true
9 changes: 5 additions & 4 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ FROM node:20-alpine

WORKDIR /usr/src/app

COPY package.json package-lock.json ./
COPY package.json pnpm-lock.yaml ./
COPY prisma ./prisma

RUN npm install
RUN npm i pnpm -g

RUN pnpm install

COPY . .

EXPOSE 3000

CMD ["npm", "run", "dev:docker"]

CMD ["pnpm", "dev:docker"]
31 changes: 24 additions & 7 deletions Dockerfile.prod
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
FROM node:20-alpine
ARG DATABASE_URL
FROM node:20-alpine AS build

WORKDIR /usr/src/app
ARG DATABASE_URL

COPY . .

RUN npm install
RUN DATABASE_URL=$DATABASE_URL npx prisma generate
RUN DATABASE_URL=$DATABASE_URL npm run build
RUN npm install -g pnpm && \
pnpm install && \
pnpm add sharp && \
pnpm run build && \
DATABASE_URL=$DATABASE_URL pnpm dlx prisma generate

EXPOSE 3000

CMD ["npm", "run", "start"]

FROM node:20-alpine AS run

RUN mkdir /.npm && chown -R 1001:1001 /.npm

USER 1001:1001
WORKDIR /usr/src/app

COPY --from=build --chown=1001:1001 usr/src/app/.next/standalone ./
COPY --from=build --chown=1001:1001 usr/src/app/.next/static ./.next/static
COPY --from=build --chown=1001:1001 usr/src/app/public ./public

ENV NODE_ENV production
ENV PORT 3000
ENV HOSTNAME "0.0.0.0"

CMD [ "node", "server.js" ]
184 changes: 42 additions & 142 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,79 +1,27 @@
<h1>CMS - 100xDevs</h1>
<h1 style="font-size: 40px;">CMS - 100xDevs</h1>

## Table of Contents
Open source repo for app.100xdevs.com

- [Installation](#installation)
## Running Locally

- [With Docker](#with-docker)

- [Without Docker](#without-docker)

- [Usage](#usage)

- [Contributing](#contributing)

- [Contributors](#contributors)

- [Troubleshooting](#troubleshooting)

## Installation

### With Docker

1. Clone the repository:

```bash

git clone https://github.com/code100x/cms.git

```



2. Navigate to the project directory:

```bash

cd cms

```



3. Run the following command to start the application:

```bash

docker volume create postgres-data # (optional) run this command if you face any mount volume / volume not exist error

docker-compose up

```



### Without Docker
> [!NOTE]
> This project uses [pnpm](https://pnpm.io/) only as a package manager.
1. Clone the repository:

```bash

git clone https://github.com/code100x/cms.git

```

2. Navigate to the project directory:

```bash

cd cms

```

3. (Optional) Start a PostgreSQL database using Docker:

```bash

docker run -d \

--name cms-db \
Expand All @@ -87,90 +35,57 @@ docker run -d \
-p 5432:5432 \

postgres

```

The connection URL for this setup will be:

```
DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/mydatabase?schema=public
```

4. Create a `.env` file based on the `.env.example` file and configure the `DATABASE_URL` with your PostgreSQL connection string.

```bash

cd cms

```

3. (Optional) Start a PostgreSQL database using Docker:
4. Create a .env file:

```bash
- Copy `.env.example` and rename it to `.env`.

docker run -d \

--name cms-db \

-e POSTGRES_USER=myuser \

-e POSTGRES_PASSWORD=mypassword \

-e POSTGRES_DB=mydatabase \

-p 5432:5432 \

postgres

```

The connection URL for this setup will be:

```
DATABASE_URL=postgresql://myuser:mypassword@localhost:5432/mydatabase?schema=public
```

4. Create a `.env` file based on the `.env.example` file and configure the `DATABASE_URL` with your PostgreSQL connection string.
- Configure the `DATABASE_URL` with your PostgreSQL connection string.

5. Install dependencies:

```bash

pnpm install

```

6. Run database migrations:

```bash

pnpm run prisma:migrate

```

7. Seed the database:
7. Generate prisma client

```bash
pnpm prisma generate
```

pnpm run db:seed
8. Seed the database:

```bash
pnpm run db:seed
```

8. Start the development server:
9. Start the development server:

```bash

pnpm run dev

```

## Usage

1. Access the application in your browser at `http://localhost:3000`
1. Access the application in your browser:

```bash
http://localhost:3000
```

2. Login using any of the following provided user credentials:

Expand All @@ -180,60 +95,45 @@ pnpm run dev

## Contributing

We welcome contributions from the community! To contribute to CMS, follow these steps:

1. Fork the repository.

2. Create a new branch (`git checkout -b feature/fooBar`).

3. Make your changes and commit them (`git commit -am 'Add some fooBar'`).
We welcome contributions from the community! There are many ways to contribute to the CMS. Code is just one possible means of contribution.

> Before committing, ensure your code is properly formatted and linted:
### To contribute follow these steps:

> - Run `npm run lint:check` to check for lint errors
1. [Fork the repository](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo).

> - Run `npm run lint:fix` to automatically fix lint errors
2. Clone the fork to your local machine:

> - Run `npm run format:check` to check code formatting
> - Run `npm run format:fix` to automatically fix formatting issues
```bash
git clone https://github.com/<your username>/cms.git
cd cms
```

> Before committing, ensure your code is properly formatted and linted:
3. Create a new branch

> - Run `npm run lint:check` to check for lint errors
```bash
git checkout -b feature/fooBar
```

> - Run `npm run lint:fix` to automatically fix lint errors
4. Make your changes and commit them

> - Run `npm run format:check` to check code formatting
```bash
git commit -am 'Add some fooBar'
```

> - Run `npm run format:fix` to automatically fix formatting issues
5. Push to the branch

4. Push to the branch (`git push origin feature/fooBar`).
```bash
git push origin feature/fooBar
```

5. Create a new Pull Request.
6. Go to [the repository](https://github.com/code100x/cms/pulls) and [make a Pull Request](https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request).

For major changes, please open an issue first to discuss what you would like to change.
> For major changes, please open an issue first to discuss what you would like to change.
Read our [contribution guidelines](./CONTRIBUTING.md) for more details.

## Contributors

<a href="https://github.com/code100x/cms/graphs/contributors">

<img src="https://contrib.rocks/image?repo=code100x/cms&max=400&columns=20" />

</a>

## Troubleshooting

### Issues on macOS Silicon

If you encounter issues on macOS with Silicon chips, you may need to install some additional dependencies. Run the following command:

```
brew install pkg-config cairo pango libpng jpeg giflib librsvg
```

If you continue to face issues, please open a GitHub issue with details about the problem you're experiencing.
Loading

0 comments on commit 7cee996

Please sign in to comment.