Skip to content

Getting Started

Ian Du edited this page Aug 11, 2025 · 46 revisions

Cloning the Repository

Clone the SCE dev tool and follow the guide for setup: https://github.com/SCE-Development/SCE-CLI#setup

sce clone c

cd Clark

sce link c

Running MongoDB

  1. Install docker:
  • Install for Windows here
  • Install for Mac here
  • Install for Linux here
  1. run mongodb with:
sce run mongo

Running setup.py

Ensure you have python3 installed and run the script with:

# if macOS or linux:
python3 setup.py
# if Windows:
python setup.py

Running the Application

Running with the sce tool

skip the below sections, just do

sce run c

the frontend will be visible at both http://localhost and http://localhost:3000. the backend can be seen at http://localhost:8080

Frontend Only

To simply run the application's frontend, paste the below command into your terminal.

npm run start

Shortly after, a window in your browser will open with the website on http://localhost:3000.

Frontend and Backend

In another new terminal window or tab, run the application with the command below:

npm run server

In yet another new terminal window or tab, run the application with the command below:

npm start

After some time, the application will load in the browser's terminal.

Creating an Account

  1. In the topmost directory of Core-v4, run
npm run create-user

Follow the prompts and if the website is running from the steps above, you should be able to login with this created account.

Setting Up GMail (Skip if you are a new dev member!)

Pre-requisite: you will need a Google Cloud Platform project setup to complete this section.

  1. Before anything, you must have a GCP(Google Cloud Project) setup.

    • Create a Google Cloud Account
    • Start a new project
    • Follow the prompts, make sure to select External in the Audience section to allow for testing
    • We can now create Clients in our app, navigate to Clients in the left side nav bar to create one
    • Add https://developers.google.com/oauthplayground the Authorized redirect URIs to allow OAuth 2.0 Playground to act as the client app and simulate the authorization flow.
    • We should now see the client appear under the Clients section
  2. Select the client we created to obtain Client ID and Client Secret.

  3. Create a new config.json file in the /api/config/ directory by simply making a copy of the existing config.example.json and renaming copy to config.json.

    • Ensure in the USER in config.json is the email you plan on using to send the verification email from.
  4. Open a terminal window and run:

    npm run generate-token
    

The terminal will prompt for Client ID, then the Client Secret, copy the Client ID and Client Secret obtained earlier from Google Cloud.

  1. You should now see the third prompt, asking you to visit a link and get an Authorization code. Before you copy the Authorization code, ensure you have selected and authorized the APIs needed in Step 1.
    • In this example we are looking to send a verification email.
    • We can use the search function to find mail related APIs
image - Select the one you feel appropriate - Click `Authorize APIs`
  1. We can now give the Authorization Code to the prompt.

    • image
  2. A token.json file should be created under /api/config/, you should see your authorization token being used there. In a terminal window use the command: (make sure you have 2 other terminal windows running the frontend and mongoDB, or one window running the full stack with sce run c)

image
- If the command throws an error, you can simply change the `NODE_ENV` variables inside `docker-config.yml`
NODE_ENV=production npm run server
  1. Now test it by sending an email to yourself!
    • Ensure your config.json's googleApiKeys section looks something like this
image
  1. If you see an email in your inbox from yourself, it worked!.
    • If you do not, ensure config.json has USER set to the email you want to be sending the email from.
  • Note: If you need to repeat this process, delete any existing token.js file.

Setting up RFID server (Skip if you are a new dev member!)

Prerequisites: Find the AWS-IOT folder in the shared google drive folder and download it.

  1. Drag and drop the AWS-IOT folder into Core-v4/api/
  2. Run npm start, npm run server and mongod commands in separate terminals
  3. Login into the website as an admin and go to RFID Manager
  4. Follow the instructions on how to setup ESP32

Having trouble?

Post any relevant screenshots in #development in the SCE Slack and we'll sort it out.

Clone this wiki locally