When applying for a tech job it is important to have a strong portfolio to impress the company. Especially for beginner developers the first impression of resume and projects are playing crucial role. The most common project types are To-do app, Weather app, Blog and etc. which is boring.
This post cross-published from Notion with OnePublish.
In this new series we will build unique and creative stuff and ship it to production. Check out previous publication from this series below:
So, in this episode we will build Email Detail Viewer that will take the MSG file as input, read its content and display it to the user.
We’re going to use a NextJS to build our app fast and ship it to production easily using Vercel. Each time we make a new commit Vercel will update our app so we don’t need to worry about deployment but only focus on building.
Why this project is great?
Because it involves many skills those required to have as a developer:
TypeScript.
Third-party integration.
Use of NextJS itself.
UI/UX skills.
Tailwind CSS (eh)
Deployment
What we are building?
This project is going to be a single page app that will let user to upload MSG File or in other terms Microsoft Outlook Item. After user uploads file, it should extract the email headers, content, attachments and other details of email then display the result to the user with nice UI/UX.
Getting Started
Let’s start by creating a new NextJS project. I will be using latest version of NextJS which is version 14 at time of writing this post.
npx create-next-app@latest
It will prompt few questions to configure the NextJS project. I will select to use TypeScript, initialise the Tailwind CSS and use App router.
✔ What is your project named? … <your_app_name_here>
✔ Would you like to use TypeScript? … No / **Yes**
✔ Would you like to use ESLint? … No / **Yes**
✔ Would you like to use Tailwind CSS? … No / **Yes**
✔ Would you like to use `src/` directory? … **No** / Yes
✔ Would you like to use App Router? (recommended) … No / **Yes**
✔ Would you like to customize the default import alias(@/*)? … No / **Yes**
Now you should have initialised NextJS project ready to use.
Building Backend
First, we need to find a library that can read the content of msg file. There is a npm package named @kenjiuno/msgreader which can read and extract the details from the .msg files.
Let's start by creating and endpoint called /api/reader that will handle POST request from frontend and pass file data to the msg reader.
The submitMsgFile handler function listens onChange event from input field. That mean's once user uploads file it wil trigger the handler function.
Next, passing the file to the FormData and sending to the endpoint.
As you noticed this component has callback prop which sends result of reader to the parent component. In page level, we will pass the result to other components to display the result.
Let's now move to the Headers component that displays result of email headers:
One more project added yo your portfolio! Feel free to display more details or change the design as you want.
You need to deploy your NextJS to Vercel to make it publicly accessible for others. Also, remember to explain your solution well in ReadMe file since it shows that you’re documenting your work.