https://github.com/One-Learn-Platform/platform
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 .env
file. Except the secret keys.Rename the .env.example
file to .env
and 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 the wrangler.toml
file.--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 start
This 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.
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