← back to writing

Building My Blog: A Modern React + TypeScript Journey

• 1 min read

In this post, I'll walk you through the process of building this blog using modern web technologies. From the initial setup to the final deployment, I'll sha...

In this post, I'll walk you through the process of building this blog using modern web technologies. From the initial setup to the final deployment, I'll share the key decisions and technologies that made this project possible.

The Tech Stack

The blog is built with a carefully selected stack of modern technologies:

  • React 18: For building the user interface
  • TypeScript: For type safety and better development experience
  • Vite: For lightning-fast development and building
  • Tailwind CSS: For styling
  • shadcn/ui: For beautiful, accessible components
  • React Router: For client-side routing
  • TanStack Query: For data fetching and caching
  • Markdown: For content management

Project Structure

The project follows a clean and organized structure:

src/
├── components/     # Reusable UI components
├── pages/         # Page components
├── posts/         # Markdown blog posts
├── utils/         # Utility functions
├── hooks/         # Custom React hooks
├── types/         # TypeScript type definitions
└── lib/           # Core functionality

## Key Features

### 1. Markdown Processing

One of the most interesting aspects of this blog is how it handles markdown content. I created a custom Vite plugin that processes markdown files and their frontmatter. This allows for:

- Writing posts in markdown
- Adding metadata through frontmatter
- Automatic parsing of tags, dates, and images
- Syntax highlighting for code blocks

### 2. Component Architecture

The blog uses a component-based architecture with shadcn/ui, which provides:

- Beautiful, accessible UI components
- Dark mode support
- Consistent styling through Tailwind CSS
- Responsive design out of the box

### 3. Routing and Navigation

React Router v6 powers the navigation, with routes for:

- Home page
- Blog listing
- Individual blog posts
- Tags pages
- About and other static pages

### 4. Performance Optimizations

Several optimizations are in place:

- Code splitting through Vite
- Image optimization
- Efficient markdown processing
- Client-side routing for fast navigation

## Development Workflow

The development process is streamlined with:

- Hot Module Replacement (HMR) for instant feedback
- TypeScript for catching errors early
- ESLint for code quality
- Prettier for consistent formatting

## Building for Production

The build process includes:

1. Processing all markdown files
1. Optimizing images
1. Bundling and minifying code
1. Generating static assets

## Lessons Learned

Building this blog taught me several valuable lessons:

1. The importance of a well-structured project
1. How to effectively use TypeScript in a React project
1. The benefits of modern build tools like Vite
1. Best practices for markdown processing
1. The value of component libraries like shadcn/ui

## Future Improvements

Some planned improvements include:

- Adding a search feature
- Implementing a newsletter subscription
- Adding comments functionality
- Improving SEO
- Adding more interactive elements

## Conclusion

Building this blog was an exciting journey into modern web development. The combination of React, TypeScript, and other modern tools made it possible to create a fast, maintainable, and beautiful blog that's a joy to write for and read.

The modular architecture means it's easy to add new features and make improvements over time. I'm looking forward to seeing how this blog evolves as I continue to learn and improve my web development skills.

## Resources

If you're interested in building something similar, here are some helpful resources:

- [Vite Documentation](https://vitejs.dev/)
- [React Documentation](https://react.dev/)
- [TypeScript Documentation](https://www.typescriptlang.org/)
- [Tailwind CSS Documentation](https://tailwindcss.com/)
- [shadcn/ui Documentation](https://ui.shadcn.com/)

share

next up