https://github.com/One-Learn-Platform/platform
- Node.js (Minimum version 18.x, LTS Version Recommended) (Download)
- PNPM (Package Manager) (Download)
- Git (Version Control System) (Download)
- Visual Studio Code (Recommended IDE) (Download)
- DB Browser (SQLite) (Download)
- Cloudflare Account (For deployment) (Sign Up)
- Bun (Optional, for local development) (Download)
-
Clone the repository to your local machine using the following command:
git clone https://github.com/One-Learn-Platform/platform.git
-
Open the project in Visual Studio Code
cd platform code .
Inside the project, you will find the following folder structure:
one-learn
├── e2e
├── r2-server -> for running R2 locally
├── src -> main application code
│ ├── lib
│ ├── routes
│ ├── app.css
│ ├── app.html
│ └── app.d.ts
├── static/
├── .env.example
├── .gitignore
├── .npmrc
├── .prettierignore
├── components.json
├── drizzle.config.ts
├── eslint.config.js
├── LICENSE
├── local.db
├── package.json
├── playwright.config.ts
├── pnpm-lock.yaml
├── prettier.config.js
├── README.md
├── svelte.config.js
├── tsconfig.json
├── vite.config.ts
└── wrangler.toml
Important Files:
src/app.css- Global CSS stylesdrizzle.config.ts- Database schema and migration configurationenv.example- Environment variables for development that mirror the productionwrangler.toml- This contains the environment variables for Cloudflare Workers. Including the ones we set in.envfile. Except the secret keys.
-
Rename the
.env.examplefile to.envand update the environment variables if needed. This file is used for local development only and should not be used in production. -
Install the required dependencies using PNPM:
pnpm install
-
Build the database locally
This command use Wrangler, it's should be automatically installed with PNPM. You can find more information about all the commands in the Wrangler Docs.pnpm wrangler d1 migrations apply prod-db --local
Key information:
d1- This is the name of the Cloudflare product for the database that One Learn uses.prod-db- This is the name of the database that One Learn uses in production. This name mirror the one we use in production, but don't worry the data is totally separated because we use--local. If you want to change the database name, you can do so in thewrangler.tomlfile.--local- This flag tells Wrangler to run the command locally instead of in the Cloudflare environment.
-
Seed the local database
This command will seed the local database with the initial data. This is useful for development and testing purposes.pnpm run seed
This command will create the minimum data needed to run the app. This will seed a super admin so you can create a school and users. The default login credentials will be displayed in the console.
-
Run the application
pnpm dev
This will start the development server and you should be able to access the application at
http://localhost:5173. -
(Optional) Because we're using Cloudflare R2, we need to run the R2 server locally to test the file upload function
cd r2-server bun run startThis command will start the R2 server and you should be able to access the R2 server at
http://localhost:3000.
One Learn can be self hosted on your own server. This guide will help you set up the server and deploy the application.
- Cloudflare Account
One Learn uses Cloudflare Pages for deployment, D1 for database and R2 for storage, all are services provided by Cloudflare. You will need to create an account on Cloudflare and set up the required services. - GitHub Account
You will need a GitHub account to clone and connect the repositories to Cloudflare pages.
-
Clone the repository
Clone the repository to your local machine using the following command:git clone https://github.com/One-Learn/one-learn.git
Coming soon... Tutorial