Hello people ๐๐ฝ
Hoping you all are safe. Firstly, sorry for not being able to bring up this article last week. It was a packed one with exams and other work.
I think this article will make up for the delay ๐ค๐ฝ
This article will be focusing on two aspects:
- Understanding the project and building a mind map for all future reference.
- Setting up the project folders and installing the required dependencies.
Building the Mind Map
The most critical part of building any application, for that matter solving any problem is analysing the functionalities and requirements of that problem.
A mind map is one of the many ways to put those points in a visual way. For smaller applications like these, the mind maps should be sufficient, but bigger applications need proper documentation.
The use cases and requirements of our Code Runner can be defined as follows:
- User should be able to type code in an editor with syntax highlighting, language specific suggestions and other features.
- User should be able to provide custom input.
- User should be able to run this program with or without the custom input.
- User should be able to save these codes, upon request.
- User should be able to retrieve codes or share them using a simple URL (UID in the slug).
I use a tool called Miro to build these mind maps and store them for further reference. Below is a mind map for our project. It should explain for itself, and it is just an overview of the application. The implementation of it shall be looked into in detail during the development process.
We clearly define the required needs of our application on both the front-end and the back-end.

Project Setup
We will setup our project in an unconventional yet fast way which helps keep the development overhead processes like installations and builds less time consuming.
The default package manager we will be using is PNPM. It is a cache-enabled package manager which allows using shared node modules using hard links. It helps to reduce the space occupied on the disk and skips redownloading the modules each time you build a new project.
To install PNPM:
npm i -g pnpm
Server Folder Structure
Now that you have PNPM installed and ready, we can start creating the project folders and install dependencies.
Create a folder called CodeRunner with a subfolder called server. (Naming can be done according to your preference) and open the main folder in an IDE or terminal.
require("dotenv").config();
const express = require("express");
const bodyParser = require("body-parser");
const cors = require("cors");
const app = express();
const mongoose = require("mongoose");
const mongoSRV = process.env.MONGO_SRV;
const port = process.env.PORT || 8000;
mongoose.connect(mongoSRV, {
"useNewUrlParser": true,
"useUnifiedTopology": true,
"useCreateIndex": true
})
.then(() => console.log("DB Connected"))
.catch((err) => console.log("Error connecting DB", err))
const corsOptions = {
origin: "*",
optionsSuccessStatus: 200
}
app.use(cors(corsOptions));
app.use(bodyParser.json());
app.listen(port, () => {
console.log(`App is running on PORT: ${port}`);
})
- Create a MongoDB Atlas instance and save the SRV value in a file called
.env in the server folder with key as MONGO_SRV.
- Create sub-folders called
routes, controllers and models in the server folder.
Client Folder Structure
Your final Project folder should look like this with the node_modules folder .env file included.
That's all for today folks.
Let's discuss the implementation of the server application in the next article.
Subscribe to the newsletter for the upcoming articles. ๐ซ
Stay safe everyone โค
Until next Sunday,
Manish Reddy Nandineni.