Source code
The source code for Website can be found in src/website
.
Its README has been copied below.
Website¶
In the website development timeline, we are currently evaluating the folllowing software stack: Next.js website (this repository), Typescript, React + Redux, and the MongoDB database. The easiest way to evaluate these potential solutions for our purposes is in sailbot_workspace.
Database¶
MongoDB is a general purpose, document-based, distributed database built for modern application developers and for the cloud era. If you want to learn more about MongoDB, visit their docs site: MongoDB Documentation.
Setup¶
Environment variables¶
We have two separate configurations: one for development .env.development
,
the other for production .env.production
. The values may vary, but the environment variables are the same. See below:
MONGODB_URI
: Your MongoDB connection string. Usemongodb://localhost:27017/<DB_NAME>
to establish a connection with the local database.NEXT_PUBLIC_SERVER_HOST
: The host URL of the website.NEXT_PUBLIC_SERVER_PORT
: The port number of the website.NEXT_PUBLIC_POLLING_TIME_MS
: The time interval for polling the database in milliseconds.
Package installation¶
The following command installs all required dependencies listed in the package.json
file:
Once the installation is complete, you should see a node_modules
directory in the project's root.
This directory contains all installed packages.
When installing a new package to the website, please follow the steps below:
-
Access the terminal of the website container on Docker.
-
Run the command
npm install <package-name>
. Replace<package-name>
with the actual name of the package you want to add. -
Should you encounter errors related to resolving peer dependencies, please re-run the command with the header
--legacy-peer-deps
. Do not to use--force
unless you're well aware of the potential consequences. -
Review the
package.json
file to ensure the new package and its version have been added to the dependencies section. - Confirm that
package-lock.json
has also been updated. This file holds specific version information to ensure consistent installations across different environments. - Once the installation process is finished, please make sure to commit the files
package.json
andpackage-lock.json
. These files are essential for version controlling the dependencies that have been added.
Run¶
Using Sailbot Workspace, the website should be up and running on http://localhost:3005.
Otherwise, you execute the following commands to run it in development mode:
Linters¶
Before merging in new changes to the repository, please execute the following commands in order:
This command runs Prettier to automatically format the code according to
the rules defined in the configuration file .prettierrc
.
This command runs ESLint to analyze the code for potential errors
and enforce coding style based on the rules defined in the configuration file .eslintrc
.