About the
@gitroom/* import paths below. They are correct and deliberate. That is the
real workspace alias in tsconfig.base.json, inherited from the upstream project, and renaming
it would break every import in the monorepo. Only the product is called PostQueen.Steps to implement a new provider
-
The backend logic:
- Define DTO for the settings of the provider
- Generate an authentication URL
- Authenticate the user from the callback
- Refresh the user token
-
The frontend logic:
- Implement the settings page
- Implement the preview page
- Upload the provider image
Social Media
Backend
For our example, we will use the X provider.1
Create a DTO for provider settings
Head over to Once created head over to
libraries/nestjs-libraries/src/dtos/posts/providers-settings and create a new file x-provider-settings.dto.tsYou do not have to create a DTO if there are no settings
libraries/nestjs-libraries/src/dtos/posts/providers-settings/all.providers.settings.ts and add the new DTO.Head to libraries/nestjs-libraries/src/dtos/posts/create.post.dto.ts, look for the discriminator and add another line, where the value is your DTO class and the name matches the provider’s identifier:2
Create the provider file
Head over to Take a look at the existing providers to see how to implement the methods.
libraries/nestjs-libraries/src/integrations/social and create a new provider file providerName.provider.tsFor oAuth2 providers, the content of the file should look like this:3
Register with Integration Manager
Open
libraries/nestjs-libraries/src/integrations/integration.manager.ts and add the new provider to either socialIntegrationList (oAuth2) or articleIntegrationList (Token)Custom functions
You might want to create custom functions for the providers for example: get available orgs, get available pages, etc. You can create a public function in the provider for exampleorganizations and later call it from a special hook from the frontend.
Frontend
1
Create provider component
Head over to
apps/frontend/src/components/new-launch/providers and create a new folder with the providerName.Add a new file providerName.provider.tsx with the following content:2
Use custom provider functions (optional)
If you want to use a custom function for the provider you can use the It will automatically interact with the right provider saved for the user.You can look at the other integrations to understand what data to put inside.
useCustomProviderFunction hook.3
Register the provider
Open
apps/frontend/src/components/launches/providers/show.all.providers.tsx and add the new provider to the list.