|
1 | | -# MoonPay DevOps Challenge |
| 1 | +# :rocket: DevOps Challenge |
2 | 2 |
|
3 | | -A Next.js application displaying cryptocurrency prices, built with Prisma 7 and PostgreSQL. |
| 3 | +:wave: Hello and welcome to the DevOps Challenge! https://github.com/moonpay/devops-challenge |
4 | 4 |
|
5 | | -## Tech Stack |
| 5 | +We're excited to see you in action! This is your time to **show off your technical skills and aptitude**. We want to understand how you think, how you solve problems, and how you apply DevOps principles to real-world scenarios. |
6 | 6 |
|
7 | | -- **Framework**: Next.js 16 (App Router, Turbopack) |
8 | | -- **Language**: TypeScript 5.9 (ESM) |
9 | | -- **Database**: PostgreSQL 17 with Prisma 7 + pg adapter |
10 | | -- **Styling**: Tailwind CSS 4 (CSS-first configuration) |
11 | | -- **Runtime**: Node.js 22 LTS |
12 | | -- **Package Manager**: pnpm |
| 7 | +This exercise uses a simple Next.js application, but our focus is on your DevOps expertise—working with Containers, CI/CD, and Infrastructure as Code (IaC). |
13 | 8 |
|
14 | | -## Quick Start |
| 9 | +**Relax and enjoy the process.** We know live coding can be stressful. We're more interested in your decision-making and approach than a perfect, finished product in the first few minutes. Please think aloud and walk us through your thought process. |
15 | 10 |
|
16 | | -### Prerequisites |
| 11 | +> **Note:** For development setup, scripts, and project structure details, see [DEVELOPMENT.md](DEVELOPMENT.md). |
17 | 12 |
|
18 | | -- Node.js 22+ (`nvm use` or `mise install`) |
19 | | -- pnpm (`corepack enable pnpm`) |
20 | | -- Docker (for PostgreSQL) |
| 13 | +## :dart: Goal |
21 | 14 |
|
22 | | -### Setup |
| 15 | +Deploy the provided Next.js application in a **production-ready** manner. |
23 | 16 |
|
24 | | -```bash |
25 | | -# Set up environment |
26 | | -cp .env.example .env |
| 17 | +## :clipboard: Requirements |
27 | 18 |
|
28 | | -# Install dependencies (runs prisma generate automatically) |
29 | | -pnpm install |
| 19 | +You should be comfortable with: |
| 20 | +1. **Docker**: Building and running containers. |
| 21 | +2. **CI/CD & IaC**: Tools like GitHub Actions, Terraform, etc. |
| 22 | +3. **Orchestration**: Kubernetes, ECS, Cloud Run, or similar. |
| 23 | +4. **Git**: Version control. |
30 | 24 |
|
31 | | -# Start PostgreSQL |
32 | | -docker compose up -d postgres |
| 25 | +## :wrench: Tasks |
33 | 26 |
|
34 | | -# Run migrations |
35 | | -pnpm db:migrate |
| 27 | +### Task 1: Containerize the Application :package: |
36 | 28 |
|
37 | | -# Start development server |
38 | | -pnpm dev |
39 | | -``` |
| 29 | +1. Write a `Dockerfile` to containerize the application. :whale: |
| 30 | + * Ensure it follows best practices for a Next.js application. |
| 31 | +2. Build and run the container locally to verify it works. :hammer_and_wrench: |
40 | 32 |
|
41 | | -The app will be available at [http://localhost:3000](http://localhost:3000). |
| 33 | +### Task 2: Deploy the Application :rocket: |
42 | 34 |
|
43 | | -## Available Scripts |
| 35 | +1. Deploy the application. We **strongly prefer deploying to Kubernetes** (local or cloud), but we are open to other cloud-based solutions (Cloudflare, AWS ECS, GCP Cloud Run, Fly.io, etc.) if that's what you're most comfortable with. |
| 36 | +2. Ensure the solution is **as close to production-ready as possible**. Consider aspects like: |
| 37 | + * Security |
| 38 | + * Scalability |
| 39 | + * Reliability |
| 40 | +3. Demonstrate that the application is reachable and returns the _Latest Crypto Prices_. :globe_with_meridians: |
44 | 41 |
|
45 | | -| Command | Description | |
46 | | -|---------|-------------| |
47 | | -| `pnpm dev` | Start development server with Turbopack | |
48 | | -| `pnpm build` | Build for production | |
49 | | -| `pnpm start` | Start production server | |
50 | | -| `pnpm db:migrate` | Run database migrations | |
51 | | -| `pnpm db:push` | Push schema changes (no migration) | |
52 | | -| `pnpm db:studio` | Open Prisma Studio GUI | |
| 42 | +## :hourglass_flowing_sand: Time & Expectations |
53 | 43 |
|
54 | | -## Project Structure |
| 44 | +You have **60 minutes** for this live session. |
55 | 45 |
|
56 | | -``` |
57 | | -├── app/ # Next.js App Router |
58 | | -│ ├── layout.tsx # Root layout with fonts |
59 | | -│ ├── page.tsx # Home page with currency table |
60 | | -│ └── globals.css # Tailwind @theme configuration |
61 | | -├── components/ # React components |
62 | | -│ ├── table.tsx # Currency table (Server Component) |
63 | | -│ └── table-placeholder.tsx # Loading skeleton |
64 | | -├── lib/ |
65 | | -│ └── prisma.ts # Prisma client with pg adapter |
66 | | -├── prisma/ |
67 | | -│ ├── schema.prisma # Database schema |
68 | | -│ ├── generated/ # Generated Prisma client (gitignored) |
69 | | -│ └── migrations/ # SQL migrations |
70 | | -├── prisma.config.ts # Prisma configuration |
71 | | -├── docker-compose.yaml # PostgreSQL + Next.js services |
72 | | -└── Dockerfile # Production container (you need to create this) |
73 | | -``` |
| 46 | +**However, if you feel you cannot complete a solution you are proud of in this time, you are welcome to treat this as a take-home assignment.** You can finish it on your own time and submit it later. We want to see your best work! |
74 | 47 |
|
75 | | -## Environment Variables |
| 48 | +## :robot: AI Usage |
76 | 49 |
|
77 | | -| Variable | Description | |
78 | | -|----------|-------------| |
79 | | -| `POSTGRES_PRISMA_URL` | PostgreSQL connection string | |
| 50 | +If you use AI tools to assist with this challenge, please bring the prompts you used to the interview. The interviewers would like to understand how you arrived at your solution. |
80 | 51 |
|
81 | | -Example: `postgres://postgres:postgres@localhost:5432/currencies?schema=public` |
82 | | - |
83 | | -## Database |
84 | | - |
85 | | -### Schema |
86 | | - |
87 | | -```prisma |
88 | | -model currencies { |
89 | | - id Int @id @default(autoincrement()) |
90 | | - name String |
91 | | - code String @unique |
92 | | - icon String |
93 | | - price Decimal @db.Decimal(15, 5) |
94 | | - createdAt DateTime @default(now()) |
95 | | -} |
96 | | -``` |
97 | | - |
98 | | -### Prisma 7 with pg Adapter |
99 | | - |
100 | | -This project uses Prisma 7's driver adapter architecture with `node-postgres` for connection pooling. The client is generated to `prisma/generated/` and configured in `prisma.config.ts`. |
101 | | - |
102 | | -## Docker |
103 | | - |
104 | | -```bash |
105 | | -# Start PostgreSQL only |
106 | | -docker compose up -d postgres |
107 | | - |
108 | | -# Start full stack (requires Dockerfile) |
109 | | -docker compose up -d |
110 | | -``` |
| 52 | +Good luck! :four_leaf_clover: |
0 commit comments