Skip to content

Commit b078e7c

Browse files
committed
initial commit ⭐
0 parents  commit b078e7c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+12645
-0
lines changed

README.md

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Welcomer Bot
2+
3+
This app was built to introduce developers to full-stack development in relation to Discord bots. The API, bot, and dashboard can be worked on independently as separate projects, so each one of them has its own README. You don't have to worry about any interlinked types, or dependencies.
4+
5+
Before starting, make sure you have the following setup:
6+
7+
- Node.js
8+
- npm
9+
- A MongoDB instance (could be local or using atlas)
10+
- A Redis instance (could be local or using a service like upstash)
11+
- A Discord application
12+
13+
## API
14+
15+
The API is the core of the stack and is responsible for handling requests from both the dashboard and the bot. In this example setup, we'll assume the URL of the API is `http://localhost:3000`.
16+
17+
The API primarily uses:
18+
19+
- [Express](https://expressjs.com/) for the server
20+
- [MongoDB](https://www.mongodb.com/) for the database
21+
- [Mongoose](https://mongoosejs.com/) to interact with MongoDB
22+
- [Redis](https://redis.io/) for caching
23+
- [ioredis](https://github.com/redis/ioredis) to interact with Redis
24+
- [Axios](https://axios-http.com/) for HTTP requests
25+
- [JWT](https://jwt.io/) for authentication cookies
26+
- [TypeScript](https://www.typescriptlang.org/) for type safety
27+
28+
To setup the API, continue reading the [API README](./api/README.md).
29+
30+
## Bot
31+
32+
The bot only handles a handful of tasks (such as listening to events), and most of the heavy lifting is handled by the API.
33+
34+
The bot uses:
35+
36+
- [Discord.js](https://discord.js.org/) to interact with Discord
37+
- [CommandKit](https://commandkit.js.org/) to handle commands and events
38+
- [Axios](https://axios-http.com/) for HTTP requests
39+
- [TypeScript](https://www.typescriptlang.org/) for type safety
40+
41+
To setup the bot, continue reading the [Bot README](./bot/README.md).
42+
43+
## Dashboard
44+
45+
The dashboard is the main way for server managers to configure the behavior of the bot. In this example setup, we'll assume the URL of the dashboard is `http://localhost:3001`.
46+
47+
The dashboard uses:
48+
49+
- [React](https://reactjs.org/) for the frontend
50+
- [Vite](https://vitejs.dev/) for the build tool
51+
- [Tailwind CSS](https://tailwindcss.com/) for styling
52+
- [DaisyUI](https://daisyui.com/) for the UI components
53+
- [Axios](https://axios-http.com/) for HTTP requests
54+
- [TanStack Query](https://tanstack.com/query) for stateful data fetching
55+
- [Jotai](https://jotai.org/) for state management
56+
- [React Router](https://reactrouter.com/) for routing
57+
- [React Toastify](https://github.com/fkhadra/react-toastify) for notifications
58+
- [TypeScript](https://www.typescriptlang.org/) for type safety
59+
60+
To setup the dashboard, continue reading the [Dashboard README](./dashboard/README.md).
61+
62+
> I didn't use Next.js for this project because I wanted to avoid the constant breaking changes that it's known for, as well as the fact I wanted to show how React behaves at its core.

api/.env.example

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
PORT=
2+
3+
API_URL=
4+
DASHBOARD_URL=
5+
6+
JWT_SECRET=
7+
8+
MONGODB_URI=
9+
REDIS_URI=
10+
11+
DISCORD_CLIENT_ID=
12+
DISCORD_CLIENT_SECRET=
13+
DISCORD_BOT_TOKEN=

api/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules
2+
dist
3+
.env
4+
.DS_Store

api/README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# API
2+
3+
To setup the API, cd into this directory and run `npm install`.
4+
5+
Once your dependencies are installed, you can setup your environment variables.
6+
7+
1. Create a `.env` file in this directory
8+
2. Copy the contents of `.env.example` into the `.env` file
9+
3. Replace the placeholders with your own values
10+
11+
Here's an example `.env` file:
12+
13+
```
14+
PORT=3000
15+
16+
API_URL=http://localhost:3000
17+
DASHBOARD_URL=http://localhost:3001
18+
19+
JWT_SECRET=a_RaNdoM_sEcReT
20+
21+
MONGODB_URI=mongodb://localhost:27017/welcomer-bot
22+
REDIS_URI=redis://localhost:6379
23+
24+
DISCORD_CLIENT_ID=1234567890987654321
25+
DISCORD_CLIENT_SECRET=m7u79832y4kljhsdf
26+
DISCORD_BOT_TOKEN=MTIzdfjhdsfkljsldkfj.orh234kmhsf.sod87fnoijwne4kl-pwo7ebrkljsbhdfhkjbsdkf
27+
```

0 commit comments

Comments
 (0)