0% found this document useful (0 votes)
14 views3 pages

Backend SDE Intern Assignment

Uploaded by

dreamwaveai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

Backend SDE Intern Assignment

Uploaded by

dreamwaveai
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment: Building a VPN Server Management API within the Apptension

SaaS Boilerplate

Objective:

Enhance the Apptension SaaS Boilerplate


(https://www.apptension.com/saas-boilerplate#saas-hero) by adding an API for managing VPN
servers. Admins can add VPN server details, and users can fetch the closest VPN server based
on their IP address and country.

Tasks:

1. Setup Apptension SaaS Boilerplate:


○ Clone the repository (https://github.com/apptension/saas-boilerplate).
○ Configure the development environment.
○ Ensure all dependencies are installed.

2. Database Schema Design:

VPN Server Table Schema:

CREATE TABLE vpn_servers (

id SERIAL PRIMARY KEY,

ip_address VARCHAR(45) NOT NULL,

latitude FLOAT NOT NULL,

longitude FLOAT NOT NULL,

vpn_key TEXT NOT NULL,

country VARCHAR(50) NOT NULL

);
3. API Endpoints:
○ POST /api/v1/addvpnservers:

Request Body:
json
{

"ipAddress": "string",

"latitude": "number",

"longitude": "number",

"key": "string",

"country": "string"

■ Function: Adds a new VPN server to the database.

○ GET /api/v1/getvpnservers:
■ Query Parameters:
■ country: string
■ userIp: string
■ Function: Returns the VPN server closest to the user's IP address within
the specified country.

Response:
json

"ipAddress": "string",

"latitude": "number",

"longitude": "number",
"key": "string",

"country": "string"

4. Implement Geolocation Logic:


○ Determine the user's location based on their IP address.
○ Calculate the distance between the user's location and available VPN servers.
○ Return the closest VPN server within the specified country.
5. Security:
○ Implement authentication and authorization for the admin.
○ Secure sensitive data such as VPN keys.
6. Testing:
○ Write unit tests for each endpoint.
○ Ensure the geolocation logic works correctly.
7. Documentation:
○ Provide clear API documentation.
○ Include instructions for setting up and running the server.

Submission:

● Submit the complete project repository.


● Upload the project on GitHub.
● Share the repository link to [email protected].

You might also like