- Notifications
You must be signed in to change notification settings - Fork8
Mentor-mentee and jobseeker-company matchmaking platform used by ReDI School of Digital Integration, in Berlin, Munich and Düsseldorf, Germany.
ReDI-School/connect
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
You'll find two sister products in this repository:
- ReDI Connect, a tool to connect mentees to mentors, deployed tohttps://connect.redi-school.org
- ReDI Talent Pool, a tool to connect jobseekers to companies and get jobs, deployed tohttps://talent-pool.redi-school.org
Both are created, run and managed byReDI School of Digital Integration. We're a non-profit school in Germany (in Berlin, Hamburg, Munich and NRW) with a community of hundreds of professionals from the digital industry volunteering to teach and mentor students. Our students are tech-interested locals and newcomers to Germany.
See theOnboarding Checklist andWorkflow for design tasks in our Wiki.
First of all, ReDI Connect and ReDI Talent Pool connect to aSalesforce
instance via theNestJS API
app. You'll need to set a number of environment variables in your.env
and.env.development
files to make various connections and features work. Reach out to @helloanil, @katamatata or @ericbolikowski to get set up.
After you've set up.env
, make sure to updateNX_DEV_MODE_EMAIL_RECIPIENT
to your own email address to receive emails from the platform.
- Make sure you're running thev20 version of Node locally. To do this, you can installnvm, which allows you to select different versions of Node via the command line. Alternatively, we have added support forVolta. So, if you choose, you can use Volta, which sets project-defined tools automatically.
- We are using
yarn
as a package manager in our repository. If you don't have it on your machine yet,install it. - Go to the root folder and run
yarn
to install the project dependencies (node_modules
). - Run
yarn start:all
to boot all apps,or a subset of apps using thestart:x
commands listed in thepackage.json
file. - Read theOnboarding Checklist in our Wiki.
You can open these in your browser:
- ReDI Talent Pool:http://localhost:2999
- ReDI Connect:http://localhost:3000
- Salesforce login:https://test.salesforce.com/ (get credentials from @katamatata, @helloanil or @ericbolikowski)
- Loopback API:http://localhost:3003, Swagger:http://localhost:3003/explorer
- NestJS API:http://localhost:3333, GraphiQL:http://localhost:3333/graphql
If you're using
VS Code
, make sure you:- Enable file nesting (setting
explorer.fileNesting.enabled
) to collapse React component.graphql
,.generated.ts
and.scss
files. This makes it easier to use the file explorer. - Install theRun on Save extension to automatically generate react-query hooks when saving .graphql files. This will speed up your development so you don't need to manually run
yarn graphql:codegen
.
- Enable file nesting (setting
We useNx Dev Tools to manage this monorepo. Find all the apps/products underapps/
and all libraries they consume underlibs/
.
Use trunk-based branching: create feature/bugfix/docs/refactor/blabla branches directly offmaster
and file PRs to merge back intomaster
. Name branches<type>/short-hyphenated-title
, wheretype
isfeat
,fix
,docs
,style
,refactor
,test
orchore
.
TheGraphiQL
playground is a tool that allows you to test theGraphQL API
. It is available athttp://localhost:3333/graphql.
The playground is a great tool to test the API, but it is not meant to be used in production. It is a development tool only.
Use it to view all the availableGraphQL
queries and mutations. Most queries and mutations require authentication. To authenticate, you need to provide a validJWT token
. You can get a validJWT token
by logging in to the ReDI Connect application. Use your browser's developer tools to view network requests. Once you are logged in, find thePOST /api/redUsers/login
request. There, copy thejwtToken
. Then, in theGraphiQL
playground, click on theHTTP HEADERS
tab. Paste the following:
{ "Authorization": "Bearer <your-jwt-token>"}
Alternatively, use Loopback's Swagger (http://localhost:3003) to manually send a login request, and copy the JWT token from the response.
See this Loom video for a demo:https://www.loom.com/share/b2328a7ec6054afebb8249ea59ef2f18
We useGraphQL
code generation to generate/updatereact-query
hooks (queries and mutations). To enable code generation after changingNestJS
entity models or any.graphql
file, first, ensure theNestJS API
is running, then executeyarn graphql:codegen
.
To automatize the codegen after changes to.graphql
files, install thisVS Code “Run on Save” extension. The repository’sVS Code
config (in.vscode/settings.json
) is already set up to enable this.
Note: If code generation doesn’t work, it might be because theNestJS API
app is not running. Make sure that it is in a running state.
- Copy the contents of
schema.graphql
in the project root folder. If you want to ensure it’s 100% up to date, first startNestJS API
(yarn start:alone:nestjs-api
), then runyarn graphql:codegen
- Open
GraphQL
Voyager:https://ivangoncharov.github.io/graphql-voyager/ - Click Change Schema > SDL > paste the file in > Display.
Schemas for data models (e.g.ConProfile
,ConMentoringSession
,TpJobseekerProfile
andTpJobListing
) are defined in two places:
- Visually, in Salesforce: Salesforce provides anObject Manager to set up Objects and their properties (e.g.
firstName
,birthDate
, etc.), through a web admin interface. Talk to Eric/Anil/Manu for access. - In code, in the
common-types
library: see the repository folderlibs/common-types/src/lib
Each data model in thecommon-types
folder is represented by aTypeScript
class. Every data model has two representations:
- As represented in thesalesforce domain: when the file name or class name ends with
Record
, the model’s structure, property names and property types reflect how the data model is. The termRecord is chosen since it’s standard terminology in Salesforce.Record is just Salesforce’s way of sayingrow orinstance. - As represented in thecore domain: when the file name or class name ends with
Entity
, the model follows a simpler and flatter structure, the same one that was used for years before CON and TP data were migrated to Salesforce. We use the termEntity as it implies a “thing”, such as a jobseeker’s profile, a mentor<>mentee match, a logged mentoring session, and so forth.
There are two important reasons why data models have two representations:
- Salesforce enforces a certain complexity in its data models. For instance, the suffix
__c
is automatically added to the name of any property we define on a model/object. There are also nested objects within objects. - For years, CON and TP data lived in a
MongoDB
database, with a simple and effective data model structure that suited our needs. After migrating all the data to Salesforce, we essentially had two choices: update all code to access data using Salesforce’s names for objects and properties, or create a wrapper / abstraction to maintain our “core” domain models as they’ve been. We chose the latter.
To convert data from one domain representation to another, we useMapper classes. Look for file names ending in.mapper
.
OurNestJS API
thereafter usesGraphQL
and code generation (codegen) to define types (both TS types and GraphQL object types) in various places. You can think of this as the data models “bubbling up” from the backend:
- All our data models, or entities, start in the
libs/common-types/src/lib
folder asTypeScript
classes NestJS
analyzes all classes with the decorator@ObjectType()
NestJS
generates aGraphQL
schema, containing all our entities in the shape of object types- The command
yarn graphql:codegen
uses thegraphql-codegen
tool to read the schema. It then generates Typescript types (seelibs/data-access/src/lib/types/types.ts
). It also scans all.graphql
files for queries and mutations, and createsreact-query
queries and mutations stored in.generated.ts
files right next to the.graphql
file.
- Authenticate users
- Store credentials in its linked MongoDB database
- Create signed URLs for uploading assets to S3
We integratedTailwindCSS into theredi-connect
andredi-talent-pool
applications to enhance styling capabilities and to enable a new UI components library -shadcn/ui.
A newly createdshared-shadcn-ui-components
library aims to replaceBulma
in our codebase. Check the usage instructions for theshared-shadcn-ui-components
library in thisREADME file.
Main benefits:
- code sharing between apps (NestJS backend, ReDI Connect, ReDI Talent Pool) - great for components, types, utilities, and much more
- one linter to rule them all - no more crazy pull requests with style changes
- one command to start it all - no more four terminal windows to start all the apps
- overall easier to extend & scale - there’s future work in the pipeline for which
Nx
is a great match (Storybook, hint hint)
ReDI Connect and ReDI Talent Pool are two React front-ends that use a Express/Loopback/NodeJS back-end to access data stored in a MongoDB database. The backend is hosted on a virtual machine, whereas the React front-ends are compiled into static assets stored on AWS S3 / CloudFront. Emails to users are sent via AWS SES. Some other static assets plus user uploads are hosted in AWS S3 buckets.
This diagram shows the current system architecture of both platforms:
We usepm2
on the production servers to manage our twoNodeJS
servers -Loopback API
andNestJS API
.
- Run
pm2 monit
for an overview of the two servers and their logs. Runpm2 status
for a quick status of the servers. - NOTE: pm2 will automatically boot
NestJS API
andLoopback API
on server restart. - To start/stop servers, run
pm2 start <server-name>
orpm2 stop <server-name>
. To restart, runpm2 restart <server-name>
. You don't need to include environment variables or various other flags,pm2
has this configuration "saved" since the first boot.
If you ever need to configure/start the servers from "scratch", here's how to do it:
[All the environment variables] pm2 restart --name loopback --log /home/ubuntu/loopback.log --max-memory-restart 250M /home/ubuntu/connect/apps/api/server/server.js
[All the environment variables] pm2 start --name nestjs-api --log /home/ubuntu/nestjs-api.log --max-memory-restart 500M connect/dist/apps/nestjs-api/main.js
If you need toupdate the environment variables, run the above command withrestart
instead ofstart
, and also add the--update-env
flag.
All the below is written by Nx.
This project was generated usingNx.
🔎Powerful, Extensible Dev Tools
Nx supports many plugins which add capabilities for developing different types of applications and different tools.
These capabilities include generating applications, libraries, etc as well as the devtools to test, and build projects as well.
Below are our core plugins:
- React
npm install --save-dev @nrwl/react
- Web (no framework frontends)
npm install --save-dev @nrwl/web
- Angular
npm install --save-dev @nrwl/angular
- Nest
npm install --save-dev @nrwl/nest
- Express
npm install --save-dev @nrwl/express
- Node
npm install --save-dev @nrwl/node
There are also manycommunity plugins you could add.
Runnx g @nrwl/react:app my-app
to generate an application.
You can use any of the plugins above to generate applications as well.
When using Nx, you can create multiple applications and libraries in the same workspace.
Runnx g @nrwl/react:lib my-lib
to generate a library.
You can also use any of the plugins above to generate libraries as well.
Libraries are shareable across libraries and applications. They can be imported from@talent-connect/mylib
.
Runnx serve my-app
for a dev server. Navigate tohttp://localhost:4200/. The app will automatically reload if you change any of the source files.
Runnx g @nrwl/react:component my-component --project=my-app
to generate a new component.
Runnx build my-app
to build the project. The build artifacts will be stored in thedist/
directory. Use the--prod
flag for a production build.
Runnx test my-app
to execute the unit tests viaJest.
Runnx affected:test
to execute the unit tests affected by a change.
Runng e2e my-app
to execute the end-to-end tests viaCypress.
Runnx affected:e2e
to execute the end-to-end tests affected by a change.
Runnx dep-graph
to see a diagram of the dependencies of your projects.
Visit theNx Documentation to learn more.
Nx Cloud pairs with Nx in order to enable you to build and test code more rapidly, by up to 10 times. Even teams that are new to Nx can connect to Nx Cloud and start saving time instantly.
Teams using Nx gain the advantage of building full-stack applications with their preferred framework alongside Nx’s advanced code generation and project dependency graph, plus a unified experience for both frontend and backend developers.
VisitNx Cloud to learn more.
About
Mentor-mentee and jobseeker-company matchmaking platform used by ReDI School of Digital Integration, in Berlin, Munich and Düsseldorf, Germany.