Skip to content

This repository was created from Rippling/Terraform/github/github-repositories

Notifications You must be signed in to change notification settings

Rippling/interneers-lab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interneers Lab

Welcome to the Interneers Lab 2025 repository! This serves as a minimal starter kit for learning and experimenting with:

  • Django (Python)
  • React (with TypeScript)
  • MongoDB (via Docker Compose)
  • Development environment in VSCode (recommended)

Important: Use the same email you shared during onboarding when configuring Git and related tools. That ensures consistency across all internal systems.


Table of Contents

  1. Getting Started with Git & Forking
  2. Prerequisites & Tooling
  3. Setting Up the Project
  4. Running Services
  5. Verification of Installation
  6. Development Workflow
  7. Making your first change and running it
  8. Running Tests (Optional)
  9. Frontend Setup
  10. Further Reading

Getting Started with Git and Forking

1. Setting up Git and the Repo

  1. Install Git (if not already):

    • macOS: Homebrew users can run brew install git.
    • Windows: Use Git for Windows.
    • Linux: Install via your distro’s package manager, e.g., sudo apt-get install git (Ubuntu/Debian).
  2. Configure Git with your name and email:

    git config --global user.name "Your Name"
    git config --global user.email "[email protected]" # Use the same email you shared during onboarding
  3. What is Forking?

    Forking a repository on GitHub creates your own copy under your GitHub account, where you can make changes independently without affecting the original repo. Later, you can make pull requests to merge changes back if needed.

  4. Fork the Rippling/interneers-lab repository (ensure you’re in the correct org or your personal GitHub account, as directed).

  5. Clone your forked repo:

    git clone [email protected]:<YourUsername>/interneers-lab.git
    cd interneers-lab
    

Prerequisites & Tooling

These are the essential tools you need:

  1. Homebrew (macOS Only)

    Why?

    Homebrew is a popular package manager for macOS, making it easy to install and update software (like Python, Node, Yarn, etc.).

    Install:

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    
  2. Python 3.13 (if you need Python scripts or a backend environment)

    • Why 3.13?

      This is the recommended version for the module’s Python-related tasks, ensuring consistency across projects.

    • Install or Upgrade:

    • Verify:

      python3 --version

      You should see something like Python 3.13.x.

    If you are getting something else , please update .bashrc or .zshrc to have alias with following

    vim ~/.zshrc   # or any preferred editor of your choice
    alias python3 = "/opt/homebrew/bin/python3.13"
    :wq      # save the file with any equivalent command
    source ~/.zshrc # or ~/.bashrc
    
  3. virtualenv or built-in venv

    Why?

    A virtual environment keeps project dependencies isolated from your system Python.

    Install

    • pip3 install virtualenv (if needed)
    • or use python3 -m venv venv

    Tutorial Refer to the Virtualenv Tutorial to learn more about why virtual environments matter.

    Verify

    • Try to activate the venv using the following command

      source venv/bin/activate         # macOS/Linux
      .\venv\Scripts\activate          # Windows
      
    • In most of the machines, your terminal prompt will be prefixed with something like (venv) (or whatever you named the virtual environment).

      alt text

    Check Which Python Is Being Used:

    1. macOS/Linux

      which python

      This should return a path inside the venv/ directory (e.g., .../my-project/venv/bin/python

    2. Windows

      where python

      This should return a path inside venv\Scripts\python.exe.

  4. Docker & Docker Compose

    Why

    We use Docker to run MongoDB (and potentially other services) in containers, preventing “works on my machine” issues.

    Install

    Verify

    Verify verison and successfull installation with docker --version and docker compose version

  5. Node.js & Yarn

    Why?

    We use React.js for our frontend, which requires Node.js. Yarn is a popular package manager for Node.

    Install

    Verify

    • Check version and installation completion with node --version and yarn --version
  6. API & MongoDB Tools

Setting Up the Project

Create a Python Virtual Environment

The python virtual env should be created inside the backend directory. Run the following commands inside the backend directory to create virtual environment.

cd backend
python3.13 -m venv venv

To activate the virtual environment, run the following command:

# macOS/Linux
source venv/bin/activate
# on Windows Powershell:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser
.\venv\Scripts\activate

Install Python Dependencies

pip3 install -r requirements.txt

By default, requirements.txt includes:

  • Django
  • pymongo (MongoDB driver)

Check your .gitignore
Make sure venv/ and other temporary files aren’t committed.


Running Services

Backend: Django

If your Django project is in backend, navigate there:

cd backend

Start the Django server on a port less likely to conflict (e.g., 8001):

python manage.py runserver 8001

Open http://127.0.0.1:8001/hello/ to see the "Hello World" endpoint.


Database: MongoDB via Docker Compose

In the project root, you’ll find (or create) a docker-compose.yaml.

To start MongoDB via Docker Compose:

docker compose up -d

Verify with:

docker compose ps

MongoDB is now running on localhost:27018. Connect using root / example or update credentials as needed.


Verification of Installation

  • Python: python3 --version
  • Docker: docker --version
  • Docker Compose: docker compose version
  • Node: node --version
  • Yarn: yarn --version

Confirm that all meet any minimum version requirements.


Development Workflow

Recommended VSCode Extensions

  • Python (Microsoft)
    Provides language server support, debugging, linting, and IntelliSense for Python code.

  • Django (optional but helpful)
    Offers syntax highlighting and code snippets tailored for Django projects.

  • ESLint (JavaScript/TypeScript linting)
    Helps maintain consistent coding style and catches errors in JavaScript/TypeScript.

  • Prettier (optional, for code formatting)
    Automatically formats your code, keeping it clean and consistent.

  • Docker
    Allows you to visualize, manage, and interact with Docker containers and images directly in VSCode.

  • (Optional) MongoDB for VSCode
    Lets you connect to and browse your MongoDB databases, run queries, and view results without leaving VSCode.


Making your first change

Backend:

Starter 0 changes:

  1. Edit the hello_world function in urls.py (or your views).
  2. Refresh your browser at http://127.0.0.1:8001/hello/.

Starter 1 changes:

Creating and Testing a Simple "Hello, {name}" API (via Query Parameters)

This section explains how to create a Django endpoint that reads a name parameter from the query string (e.g., /?name=Bob).


1. Define the View Function

Open your Django project’s urls.py (or views.py, depending on your structure). Below, we’ll define a function that looks for a name query parameter in request.GET:

# django_app/urls.py

from django.contrib import admin
from django.urls import path
from django.http import JsonResponse

def hello_name(request):
    """
    A simple view that returns 'Hello, {name}' in JSON format.
    Uses a query parameter named 'name'.
    """
    # Get 'name' from the query string, default to 'World' if missing
    name = request.GET.get("name", "World")
    return JsonResponse({"message": f"Hello, {name}!"})

urlpatterns = [
    path('admin/', admin.site.urls),
    path('hello/', hello_name), 
    # Example usage: /hello/?name=Bob
    # returns {"message": "Hello, Bob!"}
]

2. Run the Django Server

Activate your virtual environment (if not already active):

source venv/bin/activate         # macOS/Linux
.\venv\Scripts\activate          # Windows

Install dependencies (if you haven't):

cd backend  # if you are not inside  /backend already.
pip3 install -r requirements.txt

Navigate to your Django project folder (e.g., cd backend) and run the server on port 8001:

python manage.py runserver 8001

You should see:

Starting development server at http://127.0.0.1:8001/

Test the Endpoint with Postman (or Insomnia/Paw)

Install a REST client like Postman (if you haven’t already).

Create a new GET request.

Enter the endpoint, for example:

http://127.0.0.1:8001/hello/?name=Bob

Send the request. You should see a JSON response:

{
  "message": "Hello, Bob!"
}

Congratulations! you wrote your first own API.


Pushing Your First Change

  1. Stage and commit:
    git add .
    git commit -m "Your descriptive commit message"
  2. Push to your forked repo (main branch by default):
    git push origin main
    

Running Tests (Optional)

Django Tests

cd backend
python manage.py test

Docker

docker compose ps

Note: This command displays the status of the containers, including whether they are running, their assigned ports, and their names, as defined in the docker-compose.yaml file. If you have set up a MongoDB server using Docker and connected it to your Django application, you can use this command to verify that the MongoDB container is running properly.


Frontend Setup

The frontend setup instructions are located in the frontend directory. You don't need to set up the frontend until later parts of the course, but feel free to try it earlier and play around.

Head over to the frontend README to check it out: Frontend README

Further Reading


Important Note on settings.py:

  • You should commit settings.py so the Django configuration is shared.
  • However, never commit secrets (API keys, passwords) directly. Use environment variables or .env files (excluded via .gitignore).

About

This repository was created from Rippling/Terraform/github/github-repositories

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published