|
| 1 | +# Carbon Emissions Benchmarking Exercise |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +This is a fullstack development exercise for building a carbon emissions benchmarking dashboard for digital advertising. You'll work with real data from Scope3's carbon emissions API to create a system that helps advertisers understand and compare environmental impact across different properties. |
| 6 | + |
| 7 | +## Project Setup |
| 8 | + |
| 9 | +1. ** Use `nvm` to enable the correct Node.js version for the project: |
| 10 | + ```bash |
| 11 | + nvm use |
| 12 | + ``` |
| 13 | + |
| 14 | +2. Run `npm install` in the root directory to install dependencies for both the backend and frontend. |
| 15 | + |
| 16 | +### Getting Started |
| 17 | + |
| 18 | +1. **Setup Environment Variables**: |
| 19 | + ```bash |
| 20 | + cd backend |
| 21 | + cp .env.example .env |
| 22 | + # Edit .env and add your API token (provided by interviewer) |
| 23 | + ``` |
| 24 | + |
| 25 | +2. **Start the Backend**: |
| 26 | + ```bash |
| 27 | + npm run backend:start |
| 28 | + ``` |
| 29 | + |
| 30 | +3. **Start the Frontend**: |
| 31 | + ```bash |
| 32 | + npm run frontend:start |
| 33 | + ``` |
| 34 | + |
| 35 | +### Project Structure |
| 36 | + |
| 37 | +``` |
| 38 | +├── backend/ # TypeScript Express server |
| 39 | +│ ├── app.ts # Main server file with /forward endpoint |
| 40 | +│ ├── tests/ # Jest test files |
| 41 | +│ ├── .env.example # Environment variables template |
| 42 | +│ ├── jest.config.js |
| 43 | +│ └── package.json |
| 44 | +├── frontend/ # React TypeScript application |
| 45 | +│ ├── src/ |
| 46 | +│ │ ├── types.ts # TypeScript type definitions |
| 47 | +│ │ ├── api.ts # API service functions |
| 48 | +│ │ ├── constants.ts # Available channels and countries |
| 49 | +│ │ └── App.tsx # Main application component |
| 50 | +│ └── package.json |
| 51 | +├── .gitignore # Git ignore rules |
| 52 | +└── README.md |
| 53 | +``` |
| 54 | + |
| 55 | +## Understanding the Data |
| 56 | + |
| 57 | +The backend provides a `/forward` endpoint that proxies requests to Scope3's API: |
| 58 | + |
| 59 | +```bash |
| 60 | +# Example API calls: |
| 61 | +POST /forward |
| 62 | +{ "channel": "web", "country": "US" } |
| 63 | + |
| 64 | +POST /forward |
| 65 | +{ "channel": "app", "country": "GB" } |
| 66 | +``` |
| 67 | +
|
| 68 | +**Available Options:** |
| 69 | +- **Channels**: `web`, `app` |
| 70 | +- **Countries**: See `frontend/src/constants.ts` for the full list |
| 71 | +
|
| 72 | +The API returns carbon emissions benchmarks measured as emissions per thousand impressions, organized by percentiles. |
| 73 | +
|
| 74 | +## What You'll Be Building |
| 75 | +
|
| 76 | +The frontend includes a starter DataGrid displaying sample property data (Property Name, Channel, Country, CO2 values) to give you a visual starting point. |
| 77 | +
|
| 78 | +Your interviewer will provide specific tasks, but generally you'll be creating a dashboard that allows advertisers to: |
| 79 | +- View carbon emissions data for different advertising properties |
| 80 | +- Compare emissions across channels and countries |
| 81 | +- Organize and analyze collections of properties |
| 82 | +
|
| 83 | +## Resources Available |
| 84 | +
|
| 85 | +- **TypeScript Types**: Starter types in `frontend/src/types.ts` |
| 86 | +- **API Service**: Basic fetch function in `frontend/src/api.ts` |
| 87 | +- **Constants**: Predefined channels and countries in `frontend/src/constants.ts` |
| 88 | +- **Backend Testing**: Jest setup with sample tests in `backend/tests/` (run with `npm test`) |
| 89 | +- **Scope3 API Docs**: Find our documentation of the `/v2/measure` api [here](https://docs.scope3.com/reference/measure-1) |
| 90 | +
|
| 91 | +### Available UI Libraries |
| 92 | +
|
| 93 | +- **Material-UI Core**: Buttons, Cards, Typography, Forms, etc. |
| 94 | +- **MUI Data Grid**: Professional data tables with sorting, filtering, and selection |
| 95 | +- **MUI X Charts**: Bar charts, line charts, pie charts for data visualization |
| 96 | +- **MUI Icons**: Comprehensive icon library for UI elements |
| 97 | +
|
| 98 | +## Approach |
| 99 | +
|
| 100 | +- Take your time to understand the requirements and ask questions |
| 101 | +- Build incrementally - get each piece working before moving to the next |
| 102 | +- Focus on functionality over styling - Material-UI is provided for easy UI development |
| 103 | +- Consider user experience and real-world usage |
| 104 | +- Don't hesitate to ask for clarification on any requirements |
| 105 | +
|
| 106 | +Your interviewer will guide you through the specific features to implement. The goal is to demonstrate your fullstack development skills, API design thinking, and ability to build user-focused interfaces. |
0 commit comments