Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Set up project structure, auth, and database #1

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* eslint-env node */
module.exports = {
extends: [
"next/core-web-vitals",
"next/typescript",
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/stylistic",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
root: true,
rules: {
"prettier/prettier": "warn",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
},
};
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: pr-check

on:
pull_request:
types:
# default types
- opened
- reopened
- synchronize
# run when PR title or body changes
- edited
branches:
- main
jobs:
lint-and-format:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: latest

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
cache: "pnpm"

- name: Install dependencies
run: pnpm install

- name: Enforce linting rules
run: pnpm run lint

- name: Enforce formatting rules
run: pnpm run check-format

- name: Check that PR title follows conventional commits using regex
env:
TITLE: ${{ github.event.pull_request.title }}
run: |
echo "Your PR title is '$TITLE'"

regex="(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\([a-z[[:space:]]+\))?:[[:space:]].+"

if [[ $TITLE =~ $regex ]]; then
echo "PR title follows conventional commits"
else
echo "PR title does not follow conventional commits format"
echo "Prefix your PR title with a descriptor such as 'feat:' and then summarize your change"
echo "See the following link for more information: https://www.conventionalcommits.org/en/v1.0.0/"
exit 1
fi
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "all"
}
36 changes: 36 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Next.js: debug server-side",
"type": "node-terminal",
"request": "launch",
"command": "npm run dev"
},
{
"name": "Next.js: debug client-side",
"type": "chrome",
"request": "launch",
"url": "http://localhost:3000"
},
{
"name": "Next.js: debug full stack",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/next",
"runtimeArgs": [
"--inspect"
],
"skipFiles": [
"<node_internals>/**"
],
"serverReadyAction": {
"action": "debugWithEdge",
"killOnServerStop": true,
"pattern": "- Local:.+(https?://.+)",
"uriFormat": "%s",
"webRoot": "${workspaceFolder}"
}
}
]
}
84 changes: 63 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,78 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
# St. Christopher Truckers Relief Fund (SCF)

## Description

SCF is a non-profit that has multiple programs that promote the health and well-being of truckers.

They have multiple intake forms, with some on their website and some on Google Forms. Each program is managed either through an Excel spreadsheet or a database.

The goal is to consolidate all of the programs into one intake form and create admin and user dashboards.

Please read the Product Requirement Document here: (insert link later)

## Getting Started

First, run the development server:
### Prerequisites

Please have the following installed on your machine:

- Node.js
- PNPM
- MongoDB Compass
- VSCode

Please have the following VSCode extensions installed:

- Prettier
- ESLint
- Code Spell Checker
- markdownlint

### Environment Variables

Create a `.env.local` file in the root directory of the project and add the following variables:

```text
MONGODB_URI=mongodb+srv://<username>:<password>@scf-cluster.ukm7k.mongodb.net/scf-test?retryWrites=true&w=majority&appName=SCF-Cluster
NEXTAUTH_URL=http://localhost:3000/
NEXTAUTH_SECRET=
```

Please contact leadership to obtain the database credentials and the NEXTAUTH_SECRET.

### Running the App

1. Run `pnpm install` to install the dependencies.
2. Run `pnpm run dev` to start the development server.

### Contributing

Branch protections are enabled on this repository.
To contribute, please create a new branch and make a pull request.

Your pull request title must follow the conventional commits specification. An example of a valid pull request title is:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```text
feat: Add pending form submissions table
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
Your PR must pass linting, formatting, and PR title checks before it can be merged.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
The `pnpm run lint` command can be used to check for linting errors.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
The `pnpm run check-format` command can be used to check for formatting errors.

## Learn More
The `pnpm run format` command can be used to fix formatting errors.

To learn more about Next.js, take a look at the following resources:
### Testing

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
For your convenience, there are many tools available to test out components, actions, etc.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
`/test/client/page.tsx` is a page that can be accessed at `/test/client` and is used to test out client-side components.

## Deploy on Vercel
`/test/server/page.tsx` is a page that can be accessed at `/test/server` and is used to test out server-side components.

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
`/test/account/page.tsx` is a page that can be accessed at `/test/account` and is used to make test accounts.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
The `.vscode/launch.json` file is configured to run Next.js in debug mode. This can let you step through your code line by line and inspect variables.
To start debug mode, navigate to the `Run and Debug` tab in VSCode, select the mode, and click the green play button.
29 changes: 24 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,38 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"format": "prettier --write src",
"check-format": "prettier --check src"
},
"dependencies": {
"@emotion/cache": "^11.13.1",
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@hookform/resolvers": "^3.9.0",
"@mui/material": "^6.1.2",
"@mui/material-nextjs": "^6.1.2",
"bcrypt": "^5.1.1",
"mongoose": "^8.7.0",
"next": "14.2.14",
"next-auth": "^4.24.8",
"react": "^18",
"react-dom": "^18",
"next": "14.2.14"
"react-hook-form": "^7.53.0",
"zod": "^3.23.8"
},
"devDependencies": {
"typescript": "^5",
"@types/bcrypt": "^5.0.2",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
"eslint": "^8",
"eslint-config-next": "14.2.14"
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"eslint": "^8.57.1",
"eslint-config-next": "14.2.14",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"prettier": "^3.3.3",
"typescript": "^5.6.2"
}
}
Loading