This is a monorepo containing both the backend and frontend components for the Brex interview playground - a simple message system to get you started coding.
brex-interview-playground/
├── backend-kotlin/ # Kotlin Spring Boot Backend
│ ├── src/
│ │ └── main/
│ │ ├── kotlin/
│ │ │ └── brex/interview/
│ │ │ ├── config/ # Application configuration
│ │ │ ├── controller/ # REST controllers
│ │ │ ├── graphql/ # GraphQL resolvers
│ │ │ ├── model/ # Domain models
│ │ │ ├── dto/ # Data transfer objects
│ │ │ ├── repository/ # Data access layer
│ │ │ └── service/ # Business logic
│ │ └── resources/
│ │ ├── graphql/ # GraphQL schema
│ │ └── schema/ # Database schema
│ └── test/ # Test files
├── backend-python/ # Python FastAPI Backend (Alternative)
│ ├── src/
│ │ └── app/
│ │ ├── api/
│ │ │ ├── graphql/ # GraphQL schema and resolvers
│ │ │ └── rest/ # REST API endpoints
│ │ ├── database/ # Database configuration
│ │ ├── models/ # SQLAlchemy models
│ │ └── schemas/ # Pydantic schemas
│ └── tests/ # Test files
└── frontend/ # T3 Stack Frontend
├── src/
│ ├── app/ # Next.js app router pages
│ ├── components/ # React components
│ ├── graphql/ # GraphQL queries and mutations
│ ├── lib/ # Utility functions and configurations
│ ├── styles/ # Global styles and Tailwind config
│ └── types/ # TypeScript type definitions
├── public/ # Static assets
└── tests/ # Test files
You can choose between two backend implementations:
The Kotlin backend is a Spring Boot application that provides:
- REST and GraphQL APIs for simple message operations
- H2 in-memory database
- Basic message CRUD functionality
The Python backend is a FastAPI application that provides:
- REST and GraphQL APIs for simple message operations
- SQLAlchemy with SQLite database
- Strawberry GraphQL integration
- Pydantic for data validation
The frontend is built with the T3 Stack, featuring:
- Next.js 14 with App Router
- TypeScript for type safety
- Tailwind CSS for styling
- Apollo Client for GraphQL integration
- GraphQL Code Generator for type-safe GraphQL operations
For Kotlin backend:
- JDK 11 or higher
- Gradle (for building the project)
For Python backend:
- Python 3.8 or higher
- Poetry (for dependency management)
For frontend:
- Node.js 18 or higher
- npm or yarn
-
Build the Project:
cd backend-kotlin ./gradlew build -
Run the Application:
./gradlew bootRun --console=plain
-
Access the Application:
- REST API:
http://localhost:8080/api/- i.e.
http://localhost:8080/api/messages/latest
- i.e.
- GraphQL API:
http://localhost:8080/graphql
- REST API:
-
Install Poetry (if not already installed):
curl -sSL https://install.python-poetry.org | python3 - -
Install Dependencies:
cd backend-python poetry install -
Run the Development Server:
poetry run uvicorn src.app.main:app --reload --port 8080
-
Access the Application:
- REST API:
http://localhost:8080/api/- i.e.
http://localhost:8080/api/messages/latest
- i.e.
- GraphQL Playground:
http://localhost:8080/graphql
- REST API:
-
Install Dependencies:
cd frontend npm install -
Start Development Server:
npm run dev
-
Access the Application: Visit
http://localhost:3000to access the application
The project uses GraphQL Code Generator to automatically generate TypeScript types from the GraphQL schema. Make sure the backend is running when run this command.
npm run codegen-
Access the GraphQL IDE:
- For Kotlin backend:
http://localhost:8080/graphiql - For Python backend:
http://localhost:8080/graphql
- For Kotlin backend:
-
Example Query:
query { latestMessages(limit: 10) { id content createdAt } }
-
Example Mutation:
mutation { createMessage { id content createdAt } }
cd backend-kotlin
./gradlew testcd backend-python
poetry run pytest