Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanchansf authored Dec 30, 2024
0 parents commit 262b73a
Show file tree
Hide file tree
Showing 31 changed files with 5,826 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.local.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# create local copy of this file and rename to .env.local
# make sure to add .env.local to .gitignore!!
MONGO_URI={mongo-uri-here}
8 changes: 8 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"parser": "@typescript-eslint/parser",
"extends": ["next/core-web-vitals", "prettier"],
"plugins": ["prettier"],
"rules": {
"prettier/prettier": "error"
}
}
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/new-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: New Issue
about: Create a new issue
title: ''
labels: ''
assignees: ''

---

**Description**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Acceptance Criteria**
A clear and concise description of what you want to happen.

Steps:
- step 1
- step 2

**Additional Information**
Add any other context or screenshots about the feature request here.
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## Developer: {Full Name}

Closes #{ISSUE NUMBER HERE}

### Pull Request Summary

{Describe the purpose of your pull request}

### Modifications

{list out the files created/modified and a brief description of what was changed}

### Testing Considerations

{list out what you have tested and what the reviewer should verify}

### Pull Request Checklist

- [ ] Code is neat, readable, and works
- [ ] Comments are appropriate
- [ ] The commit messages follows our [guidelines](https://h4i.notion.site/Conventional-Commits-593452ad1179489399ad3bd696ef772a)
- [ ] The developer name is specified
- [ ] The summary is completed
- [ ] Assign reviewers

### Screenshots/Screencast

{put screenshots of your change, or even better a screencast displaying the functionality}
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: ci

# Controls when the workflow will run
on:
push:
branches: ["main", "develop"]
pull_request:
branches: ["main", "develop"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Use matrix strategy to test multiple Node.js versions
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Dry-run build
run: npm run build
env:
# These env variables must be set in the repository's secrets
# - Settings -> Secrets and variables -> New repository secret
MONGO_URI: ${{ secrets.MONGO_URI }}
# Add additional environment variables here

- name: Run tests
run: npm test
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"*.{js,jsx,ts,tsx}": "eslint --fix",
"*.{js,jsx,ts,tsx,css,md,json}": "prettier --write"
}
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
}
}
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# name of non-profit

{One sentence description of the project}

## Table of Contents

- [Overview](#overview)
- [Purpose](#purpose)
- [Team](#team)
- [Getting Started And Contributing](#getting-started-and-contributing)

## Overview

### Purpose

{Short paragraph description of the non-profit mission and the purpose of this project. Who will this project help, why is it necessary. Impact of the project.}

### Team

The {non-profit name} team consists of {#} Cal Poly students. Over the course of about 9 months, we worked as a team to deploy this web application. The team members are listed below:

- [First Last](https://www.linkedin.com/) - Project Manager
- [First Last](https://www.linkedin.com/) - Designer
- [First Last](https://www.linkedin.com/) - Tech Lead
- [First Last](https://www.linkedin.com/) - Tech Lead
- [First Last](https://www.linkedin.com/) - Software Developer

## Getting Started And Contributing

Visit [getting-started.md](docs/getting-started.md) on info for how to set up this repo.

Visit [contributing.md](docs/contributing.md) on info for how to contribute to this repo.
30 changes: 30 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing

Here are all of the steps you should follow whenever contributing to this repo!

## Making Changes

1. Before you start making changes, always make sure you're on the main branch, then `git pull` and `npm i` to make sure your code is up to date
2. Create a branch `git checkout -b <name-of-branch>`
3. Make changes to the code
4. `npm run lint` to ensure code standards. (running `npm run lint:fix` will fix most of the styling errors)

## Commiting Changes

When interacting with Git/GitHub, feel free to use the command line, VSCode extension, or Github desktop. These steps assume you have already made a branch using `git checkout -b <branch-name>` and you have made all neccessary code changes for the provided task.

1. View diffs of each file you changed using the VSCode Github extension (3rd icon on far left bar of VSCode) or GitHub Desktop
2. `git add .` (to stage all files) or `git add <file-name>` (to stage specific file)
3. `git commit -m "<type>[optional scope]: <description>"` or
`git commit -m "<type>[optional scope]: <description>" -m "[optional body]"` or
`git commit` to get a message prompt
4. `git push -u origin <name-of-branch>`

## Making Pull Requests

1. Go to the Pull Requests tab on [github.com](https://github.com/)
2. Find your PR, fill out the PR template
3. (If applicable, provide a screenshot of your work in the comment area)
4. Link your PR to the corresponding **Issue**
5. Request a reviewer to check your code
6. Once approved, your code is ready to be merged in 🎉
73 changes: 73 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Getting Started

Welcome to the getting started page! Here is all you need to know to get this repo up and running on your local machine, as well as good collaborative coding practices

## Contents

- [Setup for All Developers](#setup-for-all-developers)
- [Setup for Tech Leads](#setup-for-tech-leads)
- [Helpful commands](#helpful-commands)
- [Project Structure](#project-structure)

## Setup for all Developers

1. Clone this repository `git clone <repo-url>`
2. Run `npm i` at the root of the repository
3. Create a .env file and retrieve secrets from your tech lead
4. Install IDE Extensions
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
5. Enable format on save in your IDE
1. Click the settings button in the bottom left
<img src="./images/vs-code-settings.png" alt="VSCode Settings 1" width="500"/>
2. Search "formatter" and set your default formatter to Prettier
3. Search "format on save" and click the checkbox
6. Familiarize yourself with [Helpful Commands](#helpful-commands), the [Project Structure](#project-structure), and the [steps for contributing](./contributing.md).

## Setup for Tech Leads

1. Set up a MongoDB cluster and create a .env with the URI
2. Edit the "One time setup" section above as needed, then execute those steps
3. Turn on branch protections for main and develop branches
1. Visit your repo on [github.com](https://github.com)
2. Click the Settings button on the top bar
3. Click the branches tab on the left sidebar
4. Click add rule
5. Click "Require a pull request before merging"
6. Create
<img src="./images/require-code-review.png" alt="Require Code Review" width="500"/>
4. See [template-features.md](./template-features.md) for features included in this template repository.

## Helpful commands

- `npm run dev`: Start your local development environment at [http://localhost:3000](http://localhost:3000)
- `npm run lint`: make sure Prettier and ESLint pass
- `npm run lint:fix`: make sure Prettier and ESLint pass and try to automatically fix all issues (some ESLint issues must be resolved manually)
- `git stash`: Temporarily remove all local changes to a branch and save them. Good when you need to hop to another branch without committing your current code.
- `git stash apply`: Reapply most recent git stash.
- `git merge orgin/master`: Pull all changes from the main branch to yours, good for resolving merge conflicts.

## Project Structure

- [**.github**](/.github) Github Actions CI/CD and Issue/PR templates
- [**docs**](/docs) Documentation - Documentation that came with the template repository
- [**public**](/public) Assets for frontend [Read More](https://nextjs.org/docs/pages/building-your-application/optimizing/static-assets)
- [**src**](/src) All application code
- [**app**](/src/app/) Frontend and API code
- [**api**](/src/app/api) All API routes
- [**components**](/src/app/components) All React components
- [**/\***](/src/app/) App router routes for pages
- [**styles**](/src/app/styles) All CSS files
- [**database**](/src/database) MongoDB schemas and related files

This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Learn More about Next.js

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

- [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.
- [NextAuth Documentation](https://next-auth.js.org/) - learn about authentication and authorization with NextAuth

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
Binary file added docs/images/require-code-review.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/vs-code-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions docs/template-features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Template Features

This template uses Next.js version 14.0.0. The following lists what is configured and included:

1. App router with `src/app` folder
2. Basic project file structure (see Project Structure in [getting-started.md](./getting-started.md))
3. Some database setup with a database connection function in `src\database\db.ts` and example User schema
4. Example frontend route and example api route
5. Built-in Next.js eslint
6. Import aliasing. See paths in `tsconfig.json` for predefined aliases
7. Template documentation to fill in
8. Two branches called `develop` and `main` (if you selected copy branches when creating from template)
9. Issue and Pull Request templates. Modify them in the `.github` folder
10. Some common GitHub tags
11. Pre-commit linting hook with Husky and lint-staged
12. Continuous integration with GitHub Actions

Last updated 10/17/2024
4 changes: 4 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}

module.exports = nextConfig
Loading

0 comments on commit 262b73a

Please sign in to comment.