Skip to content

Commit 4cb52ed

Browse files
docs: Update README.md on setup procedures (#39)
* Revise README with updated setup instructions Updated installation instructions and added common errors section. * Revise installation and environment variable setup Updated installation instructions and environment variable setup in README.md. Changed example values for DATABASE_URL and DIRECT_URL, and clarified steps for setting up BOT_TOKEN and ngrok. * Fix formatting in README for ngrok authtoken step * Modify database URL placeholders in README * docs: Update README.md on setup procedures * chore: Format README.md --------- Co-authored-by: TheMythologist <leekaixuan2001@gmail.com>
1 parent 1cf4aae commit 4cb52ed

3 files changed

Lines changed: 42 additions & 20 deletions

File tree

.env.example

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@ DATABASE_URL=
44
# Direct connection to the database. Used for migrations
55
DIRECT_URL=
66

7+
# Retrieve these values based on your Telegram dev bot
78
BOT_TOKEN=
8-
SECRET_KEY=
9-
109
NEXT_PUBLIC_TELEGRAM_LOGIN_BOT=
1110

11+
# Can be left blank - set only in production
12+
SECRET_KEY=
1213
NEXT_PUBLIC_POSTHOG_KEY=
1314
NEXT_PUBLIC_POSTHOG_HOST=

README.md

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,60 @@ The frontend for the NUSCC Website.
55
## 💻 Technologies Used
66

77
- **Frontend**: Next.js, React, TypeScript
8+
- **Database**: Prisma, Supabase
89
- **Styling**: Tailwind CSS, Shadcn UI components
9-
- **State Management**: React Hooks (useState, useEffect)
10-
- **Icons**: Lucide React
11-
- **Date Handling**: date-fns
1210

1311
## 🚀 Getting Started
1412

1513
### Prerequisites
1614

17-
- Node.js (v20+)
18-
- pnpm
15+
- Node.js (v22+)
16+
- [pnpm](https://pnpm.io/installation)
17+
- Any tool to expose localhost to https endpoints, such as [ngrok](https://ngrok.com/docs/getting-started) or [tunnl.gg](https://tunnl.gg/)
18+
- This guide will be assuming you are using ngrok
1919

2020
### Installation
2121

22+
1. Set up your Telegram dev bot
23+
1. Go to [@BotFather](https://t.me/BotFather) on Telegram
24+
1. Run `/newbot`
25+
1. Enter a username for the bot (e.g. nusc_web_dev_bot) -> BotFather will send with a BOT_TOKEN e.g. XXXXXXXX
26+
1. In your `.env` file, set the following variables:
27+
- Set `BOT_TOKEN` with the token given by [@BotFather](https://t.me/BotFather)
28+
- Set `NEXT_PUBLIC_TELEGRAM_LOGIN_BOT` with your bot username
29+
2230
1. Clone the repository:
2331

24-
```bash
25-
git clone https://github.com/usdevs/NUSCweb
26-
cd NUSCweb
27-
```
32+
```bash
33+
git clone https://github.com/usdevs/NUSCweb
34+
cd NUSCweb
35+
```
2836

2937
1. Install dependencies:
3038

31-
```bash
32-
pnpm install
33-
```
39+
```bash
40+
pnpm install
41+
```
42+
43+
1. Setup your environment variables in `.env` file, with `.env.example` for reference
44+
45+
1. Expose your localhost port:
3446

35-
1. Setup your environment variables in `.env` file
47+
```bash
48+
ngrok http 3000
49+
```
50+
51+
- Retrieve your custom HTTPS URL (e.g. https://xxx.ngrok.io)
52+
- In [@BotFather](https://t.me/BotFather), run `/setdomain`, choose your nusc dev bot, and enter the ngrok URL
3653

3754
1. Run the development server:
3855

39-
```bash
40-
pnpm dev
41-
```
56+
```bash
57+
pnpm dev
58+
```
59+
60+
1. Access our dev server via the ngrok HTTPS URL (e.g. https://xxx.ngrok.io)
61+
62+
## ❓ Common Errors
4263

43-
1. Open <http://localhost:3000> in your browser to see the frontend.
64+
1. If you see "Bot domain invalid" on the top nav bar, ensure your accessing your dev environment via the ngrok HTTPS URL, not your localhost

src/lib/utils/server/jwt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { default as jwt } from 'jsonwebtoken';
22

3-
const SECRET_KEY = process.env.SECRET_KEY || 'hello';
3+
const SECRET_KEY = process.env.SECRET_KEY || 'secret';
44

55
export const generateToken = (payload: string | Buffer | object): string =>
66
jwt.sign(payload, SECRET_KEY, {

0 commit comments

Comments
 (0)