initial code commit

This commit is contained in:
swve
2023-05-27 17:09:24 +02:00
parent 2edbd37856
commit 949e3ef295
49 changed files with 4028 additions and 0 deletions

BIN
.github/images/readme/docs.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 673 KiB

42
.gitignore vendored Normal file
View File

@@ -0,0 +1,42 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# next.js
/.next/
/out/
# production
/build
# misc
.DS_Store
*.pem
# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*
# local env files
.env*.local
# vercel
.vercel
# typescript
*.tsbuildinfo
next-env.d.ts
# Sentry
.sentryclirc
# Sentry
next.config.original.js

8
README.md Normal file
View File

@@ -0,0 +1,8 @@
# LearnHouse Docs
<p align="center">
<a href="https://docs.learnhouse.app">
<img src=".github/images/readme/docs.png" height="300">
</a>
</p>

26
components/Logo/Logo.jsx Normal file
View File

@@ -0,0 +1,26 @@
import Image from "next/image";
import React from "react";
function Logo() {
const [colorScheme, setColorScheme] = React.useState("");
React.useEffect(() => {
const rootElement = window.document.documentElement;
const computedStyle = window.getComputedStyle(rootElement);
const colorSchemeValue = computedStyle.getPropertyValue("color-scheme").trim();
setColorScheme(colorSchemeValue);
}, []);
return (
<div>
{colorScheme === "dark" ? (
<Image style={{ paddingTop: 35, paddingBottom: 35, paddingRight: 30 }} width={185} height={35} src="/img/logos/white_logo.png" alt="Dark Logo" />
) : (
<Image style={{ paddingTop: 35, paddingBottom: 35, paddingRight: 30 }} width={185} height={35} src="/img/logos/black_logo.png" alt="Light Logo" />
)}
</div>
);
}
export default Logo;

9
next.config.js Normal file
View File

@@ -0,0 +1,9 @@
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.jsx',
})
module.exports = withNextra()
// If you have other Next.js configurations, you can pass them as the parameter:
// module.exports = withNextra({ /* other next.js config */ })

3580
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
package.json Normal file
View File

@@ -0,0 +1,23 @@
{
"name": "learnhouse-docs",
"version": "0.1.0",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@react-aria/ssr": "^3.6.0",
"@vercel/analytics": "^1.0.1",
"next": "^13.4.2",
"nextra": "^2.5.2",
"nextra-theme-docs": "^2.5.2",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "20.1.4",
"typescript": "5.0.4"
}
}

8
pages/_app.tsx Normal file
View File

@@ -0,0 +1,8 @@
import { Analytics } from '@vercel/analytics/react';
export default function App({ Component, pageProps }) {
return <>
<Component {...pageProps} />
<Analytics />
</>
}

5
pages/_meta.json Normal file
View File

@@ -0,0 +1,5 @@
{
"index": "Introduction",
"features": "Features",
"technical-docs": "Technical Docs"
}

View File

@@ -0,0 +1,6 @@
{
"courses": "Courses",
"activities": "Activities",
"collections": "Collections",
"trail": "Trail"
}

View File

@@ -0,0 +1,5 @@
{
"dynamic-pages": "Dynamic Pages",
"documents": "Documents",
"videos": "Videos"
}

View File

@@ -0,0 +1,5 @@
# Documents
Using Document activities, you can upload a document (pdf for now) and make it part of your course.
This is an important feature that can enhance the learning experience of your students. With this tool, you can provide them with additional resources and reading materials that can help them understand the concepts better.

View File

@@ -0,0 +1,19 @@
# Dynamic pages
Dynamic pages are pages that can contains different types of content at the same time, we call them blocks.
<br/>
<img style={{borderRadius:10}} quality={100} src="/img/pages/activities/editor.png" alt="Hello" width={800} height={1300} />
There is different Blocks for you to choose :
- Callouts : Banners that contains informations, warnings, etc.
- Images : Uploadable Images.
- Video : Uploadable Video Content.
- YouTube Video : Videos from YouTube.
- Math Equations : Equations in LaTeX format.
- PDF Document : PDF files that can be viewed directly from the page.
- Interactive Quiz : Quizzes with questions and answers.
- We’ll add more soon.
We designed the Dynamic Editor to be extremely easy to use and easy to learn, we’re also making it collaborative and up to 5 persons can collaborate on the same page.

View File

@@ -0,0 +1,5 @@
# Video Activities
Video activities serve as valuable resources to enhance the learning experience by providing visual and audio content.
You can either upload your videos or use videos from YouTube and we’ll add more video sources later.

View File

@@ -0,0 +1,15 @@
import Image from 'next/image'
import { Callout } from 'nextra-theme-docs'
# Collections
Collections is a feature that enables teachers to group and organize courses based on similar themes, topics, or learning objectives.
By using collections, learners can easily navigate through a variety of courses that are relevant to their interests and goals.
<br/>
<Image style={{borderRadius:10}} quality={100} src="/img/pages/collections/collections.png" alt="Hello" width={800} height={500} />
Furthermore, collections can be used to create personalized learning paths that cater to the unique needs and preferences of individuals (will be supported in a future update)
With collections, users can also save time and effort by accessing all relevant courses in one place, instead of having to search for them individually. In addition, collections can serve as a tool for instructors and administrators to provide a more structured and coherent learning experience to their learners, by grouping courses in a logical and meaningful way.

View File

@@ -0,0 +1,35 @@
import { Callout } from 'nextra-theme-docs'
import { Card, Cards } from 'nextra-theme-docs'
import Image from 'next/image'
# Courses
Courses are a fundamental feature of LearnHouse, they should contain chapters and chapters contains activities.
<br/>
<img style={{borderRadius:10}} quality={100} src="/img/pages/courses/courses.png" alt="Hello" width={800} height={1300} />
There is a wide variety of Activities types to choose from, and we are constantly adding more.
<Cards>
<Card icon={<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6">
<path strokeLinecap="round" strokeLinejoin="round" d="M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" />
</svg>
} title="Videos" href="/features/activities/videos">
</Card>
<Card icon={<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6">
<path strokeLinecap="round" strokeLinejoin="round" d="M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" />
</svg>
} title="Dynamic Pages" href="/features/activities/dynamic-pages">
</Card>
<Card icon={<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6">
<path strokeLinecap="round" strokeLinejoin="round" d="M21 7.5l-9-5.25L3 7.5m18 0l-9 5.25m9-5.25v9l-9 5.25M3 7.5l9 5.25M3 7.5v9l9 5.25m0-9v9" />
</svg>
} title="Documents" href="/features/activities/documents">
</Card>
</Cards>
Courses can be part of a Collection, saving users time and effort by accessing all relevant courses in one place, instead of having to search for them individually. In addition, collections can serve as a tool for instructors and administrators to provide a more structured and coherent learning experience to their learners, by grouping courses in a logical and meaningful way.
When **Starting a new Course** progression data is stored in your Trail, including Quizzes data and Assignments (Coming soon)

5
pages/features/trail.mdx Normal file
View File

@@ -0,0 +1,5 @@
import { Callout } from 'nextra-theme-docs'
import { Card, Cards } from 'nextra-theme-docs'
import Image from 'next/image'
# Trail

22
pages/index.mdx Normal file
View File

@@ -0,0 +1,22 @@
# Getting started with LearnHouse
## What is LearnHouse?
LearnHouse is an open source platform that makes it easy for anyone to provide world class educational content and it offers a variety of content types : Dynamic Pages, Videos, Documents & more..
<br/>
<img quality={100} src="/img/pages/features.png" alt="Hello" />
## Features
- 📄✨Dynamic notion-like pages
- 👨‍🎓 Easy to use
- 👥 Multi-Organization
- 📹 Supports Uploadable Videos and external videos like YouTube
- 📄 Supports documents like PDF
- 🍱 Course Collections
- 🙋 Quizzes
- 👟 Course progress
- ⚡ (Incoming) Live Collaboration
- More to come

View File

@@ -0,0 +1,6 @@
{
"infra-overview": "Infrastructure Overview",
"api-overview": "API Overview",
"database-overview": "Database Overview",
"self-hosting": "Self Hosting"
}

View File

@@ -0,0 +1,5 @@
import { Callout } from 'nextra-theme-docs'
<Callout type="info" >
This page is still work in progress.
</Callout>

View File

@@ -0,0 +1,5 @@
import { Callout } from 'nextra-theme-docs'
<Callout type="info" >
This page is still work in progress.
</Callout>

View File

@@ -0,0 +1,15 @@
import { Callout } from "nextra-theme-docs";
import Image from "next/image";
# Infrastructure Overview
LearnHouse is separated into two parts/codebases :
- **Frontend** : Web interface for the user to interact with the application, some parts are server rendered and some are client rendered, we use React Server Components enabled by Next.js 13
- **Backend** : Backend code in Python using FastAPI that handles : Storage, Authentication, Uploads etc.
Here is a diagram that explains the infrastructure in a simple way to get started :
<br />
<img style={{ borderRadius: 10 }} quality={100} src="/img/schemas/infra_overview.png" alt="Hello" width={800} height={500} />

View File

@@ -0,0 +1,7 @@
{
"overview": "Overview",
"organization-hosting-modes": "Organization Hosting Modes",
"docker-and-kube": "Docker and Kubernetes",
"vercel": "Using Vercel",
"content-storage": "Content Storage"
}

View File

@@ -0,0 +1,14 @@
# Filesystem Storage
Images, Documents and Videos can be stored in your filesystem, it uses the `/content` folder on the project directory to store files.
<br/>
<img style={{borderRadius:10}} quality={100} src="/img/pages/storage/fs.png" alt="Hello" width={800} height={1300} />
## Containers
If you are using Kubernetes or Containerised environments you should make sure to use **Volumes (Docker)** or **Persistent Volumes (Kubernetes)** for your `/content` folder
- [Docker Volumes](https://docs.docker.com/storage/volumes/)
- [Kubernetes](https://kubernetes.io/docs/concepts/storage/persistent-volumes/)

View File

@@ -0,0 +1,5 @@
import { Callout } from 'nextra-theme-docs'
<Callout type="info" >
We're still working on S3-compatible storage support.
</Callout>

View File

@@ -0,0 +1,57 @@
import { Callout } from 'nextra-theme-docs'
import { Steps } from 'nextra-theme-docs'
# Docker and Kubernetes
<Callout type="warning" >
LearnHouse is still in **alpha** and is not yet ready for production use.
</Callout>
## Docker
<Steps>
### Install Docker
To install Docker, follow the instructions for your operating system on the [Docker website](https://docs.docker.com/get-docker/).
### Download the LearnHouse repository
```bash copy
git clone https://github.com/learnhouse/learnhouse
```
#### Go to the directory
```shell copy
cd learnhouse
```
### Build and run the backend Docker image
```shell copy
docker-compose up -d
```
### Build and run the frontend Docker image
#### Go to the front package
```shell copy
cd front
```
#### Build and run the frontend Docker image
```shell copy
docker-compose up -d
```
</Steps>
## Kubernetes
<Callout type="info" >
We're still working on a kubernetes deployment guide.
</Callout>

View File

@@ -0,0 +1,34 @@
import { Callout } from "nextra-theme-docs";
import Image from "next/image";
# Organization Hosting Modes
<Callout type="warning">Multi Organization setup is still work in progress </Callout>
LearnHouse supports Multi Organizations (Multi-Tenacy), which means you can have multiple organizations using the same platform and therefore the same instance of LearnHouse.
Your Organizations will share the same database and have their content, files, users on the database marked by `organization_id` and every request will be scoped to that organization.
<br />
<img style={{ borderRadius: 10 }} quality={100} src="/img/schemas/orgs_hosting.png" alt="Hello" width={800} height={500} />
## Single Organization setup
<Callout type="info">Single Organization setup is the default when installing learnhouse for the first time.</Callout>
When using a Single Organization Setup you should refer your Organization's `slug` in the **frontend config file**
### Frontend Config
```bash filename="front/.env" {1-2}
NEXT_PUBLIC_LEARNHOUSE_SELF_HOSTED=true
NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=myorg
```
## Multi Organization setup
### Frontend Config
```bash filename="front/.env" {1-2}
NEXT_PUBLIC_LEARNHOUSE_SELF_HOSTED=false
```

View File

@@ -0,0 +1,5 @@
# Self Hosting Overview
LearnHouse is open source software and can be installed and maintained on just about any Cloud provider, we also support different hosting schemas like using AWS S3 or CloudFlare R2 for content storage or using Vercel for frontend hosting.

View File

@@ -0,0 +1,5 @@
import { Callout } from 'nextra-theme-docs'
<Callout type="info" >
We're still working on a Vercel guide
</Callout>

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
public/favicons/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1 @@
{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"}

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

0
styles.css Normal file
View File

32
theme.config.jsx Normal file
View File

@@ -0,0 +1,32 @@
import Logo from "./components/Logo/Logo";
export default {
logo: <Logo />,
project: {
link: "https://github.com/learnhouse/learnhouse",
},
docsRepositoryBase: "https://github.com/learnhouse/docs/tree/main",
chat: {
link: "https://discord.gg/CMyZjjYZ6x",
},
head: (
<>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta property="og:title" content="LearnHouse Docs" />
<meta property="og:description" content="The next-gen open source learning software" />
<link rel="apple-touch-icon" sizes="180x180" href="/favicons/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicons/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicons/favicon-16x16.png" />
<link rel="manifest" href="/favicons/site.webmanifest" />
</>
),
footer: {
text: <span>{new Date().getFullYear()} © LearnHouse.</span>,
},
useNextSeoProps() {
return {
titleTemplate: "%s – LearnHouse Docs",
};
},
};

19
tsconfig.json Normal file
View File

@@ -0,0 +1,19 @@
{
"compilerOptions": {
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"incremental": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve"
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}