The goal of this project is to create a web application that enables teachers to effortlessly create and edit lessons for the Lær Kidsa Koding (LKK) website, kidsakoder.no. Our minimal requirement is a basic, functioning application that doesn't require teachers to have any knowledge of Git when editing or creating exercises for the LKK website.
-
Install Node Version Manager from here.
-
In your project's root directory, run
nvm useto install the correct Node version for this project (Current project is dependent on NodeJS v16). -
Run
npm installto install all necessary dependencies. -
Install and run Docker-Desktop.
-
Execute
docker-compose up --buildto run database containers. -
Run
npm run build-allto build frontend, contracts and thumbnailer in to the dist-folder. -
Build the backend with
npm run build-nestbackend. -
Start the backend with
npm run start-nestbackend. -
Start the frontend and thumbnailer with
npm start. -
Open http://localhost:4200/ in your browser! Happy coding!
The project is divided into three parts: the client, thumbnailer function, and server. The server handles REST API implementations needed for frontend data handling. The client includes frontend user actions such as creating new lessons, browsing user-created lessons, and editing existing lessons. The thumbnailer snaps screenshots of lessons using Puppeteer.
The frontend is written in ReactJS and uses Semantic UI React for theming. We also utilize markdown-it for parsing markdown plaintext to HTML in real-time.
Thumbnailer is a utility service that captures screenshots of lessons every time a lesson is saved. It uses Puppeteer to accomplish this.
Nestbackend manages server services, database management, and communication with Github.
- Create new OAuth app on Github here
- Create a
.envfile in the root directory. - Populate the
.envfile with environment variables as shown below:
GITHUB_CLIENT_ID= your client ID
GITHUB_CLIENT_SECRET= your client secret
GITHUB_CALLBACK_URL= your callback url. ex: http://localhost:4200/api/auth/callback
THUMB_SERVICE_URL= your thumbnailer url. ex: http://localhost:3012
GITHUB_LESSON_REPO_OWNER= your gitname
GITHUB_LESSON_REPO= your lesson_repo name ex "oppgaver"
TYPEORM_CONNECTION=postgres
TYPEORM_HOST=localhost
TYPEORM_USERNAME=orm-user
TYPEORM_PASSWORD=testing
TYPEORM_DATABASE=lesson-editor
TYPEORM_PORT=5432
DB_SYNCHRONIZE=false
DB_LOGGING=true
DB_ENTITIES=app/nestbackend/src/*/*.entity.ts
- Install Docker
- Run
docker-compose up --buildin the root directory to start the database
Removing static serving. Instead we should run frontend with a proxy to backend. In the environment files will be served by appengine. So we really don't need to serve anything statically from the backend.