Developer Internship Guide
This guide outlines the step-by-step process, required tools, and platforms for completing
the developer internship task, based on the provided problem statement.
1. Problem Statement Overview
The core task involves creating a web application with user registration, login, and a profile
management system. The application flow is as follows: Register > Login > Profile.
2. Key Requirements and Constraints
The following points are crucial and must be strictly adhered to for the internship
application to be considered:
• Code Separation: HTML, JavaScript (JS), CSS, and PHP code must reside in separate
files. No co-existence of these languages in a single file is allowed.
• Frontend-Backend Interaction: All interactions with the backend must exclusively use
jQuery AJAX. Direct form submissions are strictly prohibited.
• Styling and Responsiveness: While CSS can be used, the forms (registration, login,
profile) must be designed using Bootstrap to ensure page responsiveness.
• Database Usage:
• MySQL is required for storing registered user data.
• MongoDB is required for storing additional user profile details (age, date of birth,
contact, etc.).
• MySQL Security: When interacting with MySQL, Prepared Statements must always be
used. Simple SQL statements are not allowed.
• Session Management (Frontend): User login sessions must be maintained solely using
browser localStorage . PHP sessions are explicitly forbidden.
• Session Management (Backend): Redis must be used to store session information on
the backend.
3. Recommended Tech Stack
Based on the requirements, the following technologies are to be used:
• Frontend: HTML, CSS, JavaScript (with jQuery and Bootstrap)
• Backend: PHP
• Databases: MySQL, MongoDB
• Caching/Session Store: Redis
4. Step-by-Step Development Process
Step 1: Environment Setup
1. Install Web Server: Set up a local web server environment (e.g., Apache or Nginx) that
supports PHP.
2. Install PHP: Ensure PHP is installed and configured correctly with the web server.
3. Install MySQL: Install and configure a MySQL server. Create a database for user
registration data.
4. Install MongoDB: Install and configure a MongoDB instance. Create a database for user
profile data.
5. Install Redis: Install and configure a Redis server for backend session storage.
6. Install Composer: Install Composer for PHP dependency management.
7. Install [Link]/npm (Optional but Recommended): For frontend package
management (e.g., Bootstrap, jQuery), though direct CDN links can also be used.
Step 2: Database Schema Design
1. MySQL Schema: Design a table for user registration (e.g., users table with id ,
username , password_hash , email ). Remember to use appropriate data types and
indices.
2. MongoDB Schema: Design a collection for user profiles (e.g., profiles collection with
user_id , age , dob , contact ). The user_id should link to the MySQL users table.
Step 3: Project Structure
Create a folder structure as suggested in the document (though not fully provided, a logical
structure would be):
Plain Text
project_root/
├── public/
│ ├── [Link] (or similar entry point)
│ ├── css/
│ │ └── [Link]
│ ├── js/
│ │ └── [Link]
│ └── assets/
├── api/
│ ├── [Link]
│ ├── [Link]
│ ├── [Link]
│ └── config/
│ ├── [Link] (MySQL connection)
│ ├── [Link] (MongoDB connection)
│ └── [Link] (Redis connection)
└── vendor/ (for Composer dependencies)
Step 4: Frontend Development (HTML, CSS, JS, Bootstrap, jQuery
AJAX)
1. Registration Page ( [Link] ):
• Create an HTML form for user registration (username, password, email).
• Style the form using Bootstrap for responsiveness.
• Use jQuery to handle form submission via AJAX to [Link] .
• Implement client-side validation.
2. Login Page ( [Link] ):
• Create an HTML form for user login (username, password).
• Style the form using Bootstrap.
• Use jQuery to handle form submission via AJAX to [Link] .
• On successful login, store a token/identifier in localStorage and redirect to the
profile page.
3. Profile Page ( [Link] ):
• Create an HTML page to display user profile details (age, dob, contact).
• Style the page using Bootstrap.
• Implement a form or fields to allow users to update their profile details.
• Use jQuery AJAX to fetch existing profile data from [Link] and to submit
updates.
• Ensure that access to this page is protected by checking the localStorage for the
session token.
Step 5: Backend Development (PHP, MySQL, MongoDB, Redis)
1. Configuration Files ( config/ ):
• [Link] : Establish a secure connection to MySQL using PDO and configure prepared
statements.
• [Link] : Establish a connection to MongoDB.
• [Link] : Establish a connection to Redis.
2. Registration API ( api/[Link] ):
• Receive AJAX requests with registration data.
• Sanitize and validate input.
• Hash the password securely.
• Insert user data into the MySQL users table using Prepared Statements.
• Return appropriate JSON responses (success/failure).
3. Login API ( api/[Link] ):
• Receive AJAX requests with login credentials.
• Fetch user data from MySQL using Prepared Statements.
• Verify the password hash.
• If credentials are valid, generate a unique session token/identifier.
• Store this session token in Redis with an associated user_id and expiration.
• Return the session token to the frontend in a JSON response.
4. Profile API ( api/[Link] ):
• Receive AJAX requests (GET for fetching, POST/PUT for updating).
• Validate the session token received from the frontend (check against Redis).
• If valid, retrieve user_id from Redis.
• For GET requests: Fetch user profile details from MongoDB using the user_id .
• For POST/PUT requests: Sanitize and validate input. Update user profile details in
MongoDB for the given user_id .
• Return appropriate JSON responses.
5. Testing and Debugging
• Thoroughly test each endpoint (registration, login, profile fetch, profile update) using
tools like Postman or Insomnia.
• Test frontend functionality across different browsers and screen sizes to ensure
responsiveness.
• Verify that all constraints (e.g., jQuery AJAX, Prepared Statements, localStorage , Redis)
are met.
6. Submission
Once all tasks are completed and thoroughly tested, submit your work as per the
instructions provided in the internship document. Ensure the folder structure is clean and
all required files are present.