{"id":22576990,"url":"https://github.com/danvc/schoology","last_synced_at":"2025-04-10T17:14:41.797Z","repository":{"id":39287682,"uuid":"228704931","full_name":"danvc/schoology","owner":"danvc","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-05T03:13:11.000Z","size":10805,"stargazers_count":3,"open_issues_count":32,"forks_count":4,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T15:02:04.739Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danvc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-17T21:30:05.000Z","updated_at":"2021-03-01T04:33:54.000Z","dependencies_parsed_at":"2023-02-03T08:01:42.081Z","dependency_job_id":null,"html_url":"https://github.com/danvc/schoology","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvc%2Fschoology","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvc%2Fschoology/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvc%2Fschoology/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danvc%2Fschoology/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danvc","download_url":"https://codeload.github.com/danvc/schoology/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261916,"owners_count":21074225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-08T04:10:47.546Z","updated_at":"2025-04-10T17:14:41.772Z","avatar_url":"https://github.com/danvc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![](https://images.squarespace-cdn.com/content/v1/5cb36dc993a63270cfacbc2b/1568407625291-IZ079BSO4AO5K6YIM0PD/ke17ZwdGBToddI8pDm48kC9qu2gvgDc1fHZgGjPXHQ5Zw-zPPgdn4jUwVcJE1ZvWEtT5uBSRWt4vQZAgTJucoTqqXjS3CfNDSuuf31e0tVGsbjzQe8XprMihMEQ9UKdMwALN5jbWCRaeUKHWJatMjmVWdNHs25RwszbEzjDCTQI/Schoology?format=1000w)\n\n# Welcome to my Schoology project\n\n## Prerequisites\nDear reviewer, please, make sure to have `yarn` installed in your environment. To install it, please run:\n```\nnpm install --global yarn\n```\nYou'll also need the following CLI tools: `docker` and `docker-compose` to get it running properly.\n\n## Steps to get the App running\n### First step\nDownload the source code. You could download the source code by accessing it over this link: https://github.com/DanZeuss/schoology/archive/master.zip, or, using the `git` to clone it by running the command:\n```\ngit clone https://github.com/DanZeuss/schoology.git\n```\nIt will download all the source code inside a folder named `schoology`.\n### Second step\nBefore start the building process, please, be sure that there aren't services running in the ports `3000` (Node), `6379` (Redis) and `27017` (MongoDB). Now move to the `schoology` folder by running the command `cd schoology/` and then start the building process running the following command:\n```\nyarn build\n```\nThe `building` process will move according these steps:\n- Installs all dependencies to build and deploy an optimized version of front-end build for production;\n- Installs all dependencies to build and deploy the server package for production;\n- Download and build all containers for the application. The `app` is using `MongoDB` as database and `Redis` for caching to speed up the API responses;\n- Move all config files inside the containers;\n- Populate the `MongoDB` with fake data.\n\nIf everything wen't well, now you could access the `app` by opening the following url in your browser: `http://localhost:3000`. You will have access to main page. The Search bar search for courses by using the `lazy search`technique. So you could be searching by characters that exists in the word, without writting it correctly. The browser will only make requests after the user stop of typing after 400ms. Another approach that was taken was by using `Redis` to cache the data that was searched before in a way to improve the `app` performance.\n![](https://i.ibb.co/qswbJjh/Kapture-2019-12-18-at-3-19-48.gif)\n\n\n## API methods\nAll methods are served in the following URL path in the application: `/api/v1/` + `controller` which changes according the business (courses, classes, teachers, etc). The `v1` means the version of the current API, which could be deprecated later. The idea is to follow the best practices for verbs/paths/HTTP codes described in https://jsonapi.org.\n\nFor this presentation, we have one controller called `courses` and few CRUD methods offered by the URL `/api/v1/courses`.\n\n| URL                   |            Method              | Description                    |Payload                    |\n| --------------------- | ------------------------------ | ------------------------------ | --------------------------|\n| `/api/v1/courses`     | GET                            | Returns a list of courses      |                           |\n| `/api/v1/courses`     | POST                           | Add a new course               |`{ name: String, description: String}`\n| `/api/v1/courses/{id}`| DELETE                         | Remove a course by its id      |                           |\n| `/api/v1/courses/{id}`| GET                            | Find a course by its id        |                           |\n| `/api/v1/courses/search?q=`| GET                       | Search all courses by the name |                           |\n\nYou could perform requests using cURL (Adds a new course):\n```\ncurl -X POST \\\n  http://localhost:3000/api/v1/courses \\\n  -H 'Accept: */*' \\\n  -H 'Connection: keep-alive' \\\n  -H 'Content-Length: 389' \\\n  -H 'Content-Type: application/json' \\\n  -H 'Host: localhost:3000' \\\n  -H 'cache-control: no-cache' \\\n  -d '{\n\t\"name\": \"Business \u0026 Management Studies\",\n\t\"description\": \"A degree in a business-related subject strikes a balance between theoretical and practical work. Many business schools in the UK enjoy good relations with local and global businesses alike, meaning students benefit from cutting edge business techniques as well as high calibre work placements during their time at university.\"\n}'\n```\n\nSearch by all elements that contains the char `a`:\n```\ncurl -X GET \\\n  'http://localhost:3000/api/v1/courses/search?q=a' \\\n  -H 'Accept: */*' \\\n  -H 'Content-Type: application/json' \\\n  -H 'Host: localhost:3000' \\\n  -H 'cache-control: no-cache'\n\n```\n\n# The Architecture\nSchoologyApp was implemented having in mind a way to separate and test each layer and its dependencies in a way to speed up the deployment process. So, if something need to be changed in the front-end, it could be made easily without building or deploying something related to back-end and vice-versa. The project is structured in the following way:\n\n                \n+ app (front-end layer);\n    + build (generated automatically by running the build command);\n    + public (static files such as `JavaScript`, `CSS`, `Images`, `Fonts`, `HTML`, etc;\n    + src (main app folders and files - React/Redux/Helpers/Consts/Config/etc);\n        + __tests__ (for unit tests or environment tests using Selenium, for example);\n            + unit (Jest/Jasmin)\n            + environment (Selenium)\n        + components (which contains folders separated by its model business;\n            + account (example)\n            + courses (example)\n            + dashboard\n+ config (databases settings);\n+ data (generated automatically by the container for `db`);\n+ src (core files);\n    * handlers (contain versioned folder/files that are most related to crud/business/logic/calc)\n        + v1\n            + classes (each folder is specific for its business)\n            + courses\t\n            + students\t\n        + v2\n        + v3\n    * models (contain database schema for each model)\n        + classesModel.js\n        + coursesModel.js\n    * routes (contain files that serves routes for the main server. It's also versioned thinking in the contract of the API)\n        + v1\n            + classesRoute.js\n            + coursesRoute.js (contains an array of routes. Each route contains the path/verb and method defined)\n            + studentsRoute.js\t\n        + v2\n        + v3\n    * tests (folder for unit, environment and integration tests);\n        + integration (to call and simulate the APIs);\n            + v1\n                + courses.test.js\n                + students.test.js\n            + v2\n            + v3\n        + unit (to call and simulate CRUDS and business implementations);\n            + v1\n                + courses.test.js\n                + students.test.js\n            + v2\n            + v3\n        + lib (contains helpers for tests);\n+ common files (git, docker, json, etc);\n\n# Dev environment\nTo start the dev environment, we need to start the `MongoDB` and `Redis` container. For this purpose, run the command:\n```\ndocker-compose up -d db redis\n```\nYou also needs to start the Web application by running the command in the root:\n```\nyarn startreload\n```\nTo be working in the front-end, you'll need to do something else. Please, access the `app` folder and then run `yarn start` to start the hotreload and the server for the static files.\n\n## Running tests\nThere are tests specific for `API` and others tests for `React` components.\nTo run the `API` tests, move to the root folder and run the following command:\n```\nyarn test\n```\nTo run the test for `front-end`, please, move to the `/app` folder and run the same command.\n\n\n## Todos (ideas)\n- [ ] Add `nginx` for loading balance with `nodejs`;\n- [ ] Automate the CI/CD using the Github webhooks with a server running Jenkins;\n- [ ] Choose a library to document the API (Swagger, API Blueprint, etc);\n\n# Thank you so much\nIndependent the result, I really woud like to thank you by the opportunity that you gave me to implement this homework. I really would appreciate if you get a chance to see the details in the source code. I really loved ❤️ to be working on this. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvc%2Fschoology","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanvc%2Fschoology","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanvc%2Fschoology/lists"}