A server for Brooklyn Tech's app hub!
This is supposed to be run in addition to the app: https://github.com/ZarmDev/BTHSHub-App
Copyright (c) 2025 ZarmDev. All rights reserved.
All linux distributions
git clone https://github.com/microsoft/vcpkg.git
cd vcpkg
./bootstrap-vcpkg.sh --disableMetrics
nano ~./bashrc
add this to ~./bashrc
export VCPKG_ROOT=[your-vcpkg-root]
then run
source ~/.bashrc
IF THIS DOES NOT WORK THEN EDIT CMakePresets.json and add your root rather than it having
$env{VCPKG_ROOT}
Debian based
sudo apt update
sudo apt install -y ninja-build build-essential
Debian based
sudo apt install redis-server
Arch
sudo pacman -S redis
All linux distributions You may have to enable it as system service (personally, I didn't have to)
sudo systemctl enable redis-server
sudo systemctl start redis-server
git clone https://github.com/sewenew/redis-plus-plus.git
cd redis-plus-plus
mkdir build && cd build
cmake ..
make
sudo make install
Debian based
sudo apt install -y libsodium-dev
Arch
sudo pacman -S libsodium
- Ensure you have Cmake extension in Vscode or run cmake in the CLI
- Run
openssl rand -hex 32in order to get a private key. Set it to JWT_SECRET in .env - Add an admin password
- Either set PRODUCTION to TRUE or FALSE depending on if you are debugging or trying to run the server in production
JWT_SECRET=xxx
ADMINPASS=xxx
PRODUCTION=FALSE
- Add the path to your vcpkg root to CMakePresets.json at "CMAKE_TOOLCHAIN_FILE". There is already a value there so just replace it.
- Run the redis server
redis-server &
- Use the run button at the bottom in vscode or use the Cmake CLI commands below:
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE=[put-your-vcpkg-root]/scripts/buildsystems/vcpkg.cmake
and then
cmake --build ./build
heroku create bthshub-server
heroku config:set JWT_SECRET=$(openssl rand -hex 32)
heroku config:set ADMINPASS=your_secure_admin_password
For more ideas, see ideas.md
✅ The website will be made in C++ to be extremely fast and reliable ✅ User authentication with JWT Tokens ✅ Add team creation ✅ Private or public teams ✅ Add yourself or others to teams (if you own the team or are admin) ✅ Add ability to post annoucements ✅ Add way to get all annoucements ✅ Add admins and moderator permissions/roles ✅ Admin panel ✅ Add error handling, meaning the server will always run unless a severe error occurs ❌ Add rate limiting
❌ Implement club credit system and club directory ❌ Store BTHS daily announcements and send in a nice format to phones ❌ Add rate limiting ❌ Add friend functionality ❌ Storing schedules and being able to get other user's schedule (if they are friends) ❌ Ability to delete your own account ❌ Delete and edit annoucements ❌ More team actions like deletion or removing users from teams
Likely means you forgot to return a string in your route
Example:
string updateOtherUserAdminLevel(HttpRequest &req) {
grantAdminLevel(parsed[0], parsed[1]);
// Should have returned sendString or something like:
// return sendString("200 OK", "Changed permission successfully!");
}
server.post("/api/test", updateOtherUserAdminLevel);
For security and performance, you can write a script that replaces all the routes in server.cpp to be replaced with one letter.
Make sure to log everything! Remove the system("clear") line
Try to rotate JWT_SECRET every x days using a cronjob.