The backend service serves as the interface between multiple user services and main nodejs backend. The purpose of the service is to provide a centralized platform for storing and accessing profile data of users. The hosted service is responsible for handling the interaction between the user services and the main nodejs backend. The user is responsible for developing, deploying, maintaining, and enhancing a service named Profile Service
to ensure that it continues to meet the evolving needs of the website. The profile data stored on the service is primarily used on the members page of the realdevsquad.com website, providing a comprehensive and up-to-date view of the community.
You should have some things pre-installed :
Open the terminal or command prompt: Depending on your operating system, open the terminal or command prompt to begin the cloning process.
Navigate to your desired local directory: Use the cd command to navigate to the directory where you want to store the cloned repository.
Clone the repository: Use the following command to clone the repository :
git clone https://github.com/Real-Dev-Squad/identity-service.git
- Create an application on Firebase Firestore
- Generate a service account key file
- Create an
env.json
file by copying thesample-env.json
template - Add your Firestore service credentials to the file
When adding the service account JSON to your env.json
file:
- Convert the entire JSON to a single line string
- Escape special characters:
- Replace all newlines (
\n
) with escaped newlines (\\n
) - Replace all double quotes (
"
) with escaped double quotes (\"
)
- Replace all newlines (
If your service account JSON looks like this:
{
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\nkey-content\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]"
}
It should be added to env.json
as:
{
"FIRESTORE_CREDENTIALS": "{\"type\":\"service_account\",\"project_id\":\"your-project-id\",\"private_key_id\":\"key-id\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\nkey-content\\n-----END PRIVATE KEY-----\\n\",\"client_email\":\"[email protected]\"}"
}
After completing the above steps, you can now run the server locally with your configured environment.
- Windows users need to download & install Git bash to execute the script.
- Mac/Linux users can run the script in their native terminal.
sh scripts/dev.sh
Possible Errors while running the above command
You can see service running on localhost:3000.
-
User services send profile data to the Identity service: The user services, which are developed, deployed, and maintained by the user, send profile data to the Identity service. This profile data is stored in a centralized database.
-
Identity service stores profile data: The Identity service receives the profile data from the user services and stores it in a centralized database. This ensures that all the profile data is in one place, making it easier to access and manage.
-
User services can update profile data: The user services can also update profile data stored in the centralized database through the Identity service. This ensures that the profile data is up-to-date and reflects any changes made by the user services.
We are using AWS SAM(Serverless Application Model) with golang. The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications. It provides shorthand syntax to express functions, APIs, databases, and event source mappings. With just a few lines per resource, you can define the application you want and model it using YAML. Read more about SAM here.
/profile
/verify
/health
Wish to contribute? You can find a detailed guide here
For FAQs, you can check this discussion.