|
1 | | -# bobatalks |
| 1 | +# 🌸 BobaTalks Flowers Bot |
| 2 | + |
| 3 | +A UW Blueprint x BobaTalks project that automates the **Flowers** tradition — letting students celebrate wins through a Discord bot and displaying approved posts on the BobaTalks website. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 🧭 Overview |
| 8 | + |
| 9 | +This project includes: |
| 10 | + |
| 11 | +- **Discord Bot** – Collects "Flowers" submissions and handles moderation. |
| 12 | +- **Web App (Next.js)** – Displays approved Flowers on the BobaTalks site. |
| 13 | +- **Database (Supabase)** – Stores submissions and approvals securely. |
| 14 | +- **CI/CD** – Enforces code quality and consistency through GitHub Actions. |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## ⚙️ Tech Stack |
| 19 | + |
| 20 | +| Layer | Technology | |
| 21 | +| ------------ | ----------------------------------------------- | |
| 22 | +| Bot | Node.js + TypeScript + discord.js | |
| 23 | +| Web | Next.js 15 + Tailwind CSS | |
| 24 | +| Database | Supabase (PostgreSQL) | |
| 25 | +| CI/CD | GitHub Actions | |
| 26 | +| Code Quality | ESLint, Prettier, Husky, TypeScript strict mode | |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## ✅ Local Setup Checklist |
| 31 | + |
| 32 | +| Check | Command | Expected Result | |
| 33 | +| ---------------------- | ----------------------------------- | ----------------------------------- | |
| 34 | +| Node.js installed | `node -v` | ≥ 22.x | |
| 35 | +| npm installed | `npm -v` | shows a version number | |
| 36 | +| Dependencies installed | `npm ci` | completes without errors | |
| 37 | +| Linting passes | `npm run lint` | no errors or warnings | |
| 38 | +| Formatting passes | `npm run format -- --check .` | no changed files | |
| 39 | +| TypeScript clean | `npx tsc --noEmit` | no type errors | |
| 40 | +| Precommit works | `git commit -m "test: husky check"` | runs precommit checks automatically | |
| 41 | + |
| 42 | +--- |
| 43 | + |
| 44 | +## 🧑💻 Getting Started |
| 45 | + |
| 46 | +### 1️⃣ Clone the repository |
| 47 | + |
| 48 | +```bash |
| 49 | +git clone https://github.com/uwblueprint/bobatalks-flowers.git |
| 50 | +cd bobatalks-flowers |
| 51 | +``` |
| 52 | + |
| 53 | +### 2️⃣ Install dependencies |
| 54 | + |
| 55 | +```bash |
| 56 | +npm ci |
| 57 | +``` |
| 58 | + |
| 59 | +### 3️⃣ Set up environment variables |
| 60 | + |
| 61 | +```bash |
| 62 | +cp .env.example .env |
| 63 | +``` |
| 64 | + |
| 65 | +_Fill in the placeholder values_ |
| 66 | + |
| 67 | +### 4️⃣ Run code quality checks locally |
| 68 | + |
| 69 | +```bash |
| 70 | +npm run lint |
| 71 | +npm run format -- --check . |
| 72 | +npx tsc --noEmit |
| 73 | +``` |
| 74 | + |
| 75 | +If these three pass, your setup is perfect ✅. |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## 🥪 Verifying Pre-commit Hooks |
| 80 | + |
| 81 | +We use **Husky** + **lint-staged** to enforce formatting before commits. |
| 82 | + |
| 83 | +Test it: |
| 84 | + |
| 85 | +```bash |
| 86 | +git add . |
| 87 | +git commit -m "test: check husky hook" |
| 88 | +``` |
| 89 | + |
| 90 | +Expected: Prettier and ESLint run automatically before committing. |
| 91 | + |
| 92 | +If hooks don’t run: |
| 93 | + |
| 94 | +```bash |
| 95 | +npx husky install |
| 96 | +``` |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## 🧱 Continuous Integration (CI) |
| 101 | + |
| 102 | +Every push and PR triggers **GitHub Actions** to run: |
| 103 | + |
| 104 | +- ✅ Linting (`npm run lint`) |
| 105 | +- ✅ Formatting check (`npm run format -- --check .`) |
| 106 | +- ✅ TypeScript check (`npx tsc --noEmit`) |
| 107 | + |
| 108 | +PRs can’t be merged unless these checks pass. |
| 109 | + |
| 110 | +To simulate CI locally: |
| 111 | + |
| 112 | +```bash |
| 113 | +npm ci |
| 114 | +npm run lint |
| 115 | +npm run format -- --check . |
| 116 | +npx tsc --noEmit |
| 117 | +``` |
| 118 | + |
| 119 | +--- |
| 120 | + |
| 121 | +## 🔧 Common Fix Commands |
| 122 | + |
| 123 | +| Issue | Fix | |
| 124 | +| ---------------------------- | --------------------------------------------------- | |
| 125 | +| ESLint errors | `npm run lint --fix` | |
| 126 | +| Prettier issues | `npm run format` | |
| 127 | +| Husky hook not running | `npx husky install` | |
| 128 | +| TypeScript “No inputs found” | Create a `src/` folder or place `.ts` files at root | |
| 129 | + |
| 130 | +--- |
| 131 | + |
| 132 | +## 👩💻 Contributing Guidelines |
| 133 | + |
| 134 | +1. Create a new branch: |
| 135 | + |
| 136 | + ```bash |
| 137 | + git checkout -b feature/your-feature-name |
| 138 | + ``` |
| 139 | + |
| 140 | +2. Commit using [Conventional Commits](https://www.conventionalcommits.org/): |
| 141 | + - `feat:` → new feature |
| 142 | + - `fix:` → bug fix |
| 143 | + - `chore:` → tooling / configs |
| 144 | + |
| 145 | +3. Push and open a PR — CI must pass before merging. |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## 🧮 Scripts Summary |
| 150 | + |
| 151 | +| Command | Description | |
| 152 | +| ----------------------------- | ------------------------------------- | |
| 153 | +| `npm run lint` | Run ESLint | |
| 154 | +| `npm run format` | Format with Prettier | |
| 155 | +| `npm run format -- --check .` | Check Prettier formatting (read-only) | |
| 156 | +| `npx tsc --noEmit` | Type-check only | |
| 157 | +| `npx husky install` | Reinstall Git hooks | |
| 158 | + |
| 159 | +--- |
| 160 | + |
| 161 | +> 💡 _Run this one-liner to confirm everything works:_ |
| 162 | +> |
| 163 | +> ```bash |
| 164 | +> npm run lint && npm run format -- --check . && npx tsc --noEmit |
| 165 | +> ``` |
| 166 | +> |
| 167 | +> ✅ If you see no output — congrats, your setup is perfect! |
0 commit comments