Project Documentation: Next.js Finance App and Django Polling App

p_k

PK

Posted on September 16, 2024

Project Documentation: Next.js Finance App and Django Polling App

Project 1: Finance Application (Next.js)

Overview

The Finance App is a simple yet effective platform that enables users to manage invoices and customers. Users can log in, create, edit, and delete invoices, as well as manage their customer data. The app is built with Next.js and utilizes a PostgreSQL database integrated with MySQL logic. It was successfully deployed on Vercel.

Features

  • User Authentication: Users can create accounts and log in securely to manage their financial data.

  • Invoice Management:
    Create, edit, and delete invoices.
    Invoice records are stored in PostgreSQL with MySQL logic for relational data.

  • Customer Management:
    Add, edit, or delete customer information.
    All customer data is linked to invoices.

  • Database:
    The app uses PostgreSQL as the primary database.
    MySQL logic is implemented for handling data relations.

  • Deployment:
    The app is deployed on Vercel for ease of accessibility and scalability.
    Vercel provides automatic deployments and handles environment configurations efficiently.

Tech Stack

  • Frontend: Next.js (React framework)

  • Backend: Node.js with API routes in Next.js

  • Database: PostgreSQL with MySQL logic

  • Deployment: Vercel

What I learned

  • Database Integration: I deepened my understanding of PostgreSQL and how it can be combined with MySQL logic. This helped me learn how to handle complex relational data structures and optimize database queries. and connecting the my client side to postgress db
export async function GET() {
  try {
    await pool.query('BEGIN');
    await seedUsers();
    await seedCustomers();
    await seedInvoices();
    await seedRevenue();
    await pool.query('COMMIT');

    return new Response(JSON.stringify({ message: 'Database seeded successfully' }), { status: 200 });
  } catch (error) {
    await pool.query('ROLLBACK');
    console.error('Seeding error:', error); 

    let errorMessage = 'An error occurred during seeding';
    if (error instanceof Error) {
      errorMessage = error.message;
    }
    return new Response(JSON.stringify({ error: errorMessage }), { status: 500 });
  }
}
Enter fullscreen mode Exit fullscreen mode
  • Next.js Routing: I improved my knowledge of API routes in Next.js, including how to set up server-side rendering and manage authentication efficiently.

  • Vercel Deployment: The successful deployment process on Vercel taught me how to automate builds, manage environment variables, and deploy Next.js apps for production.

Project 2: Polling Application (Django)

Overview

The Polling App is a public-facing application that allows users to vote on polls and view the results. In addition, it includes an admin interface for managing polls, adding questions, and updating poll data. The project is built using Django, leveraging its powerful framework to handle models, views, and authentication with minimal configuration.

Features

  • Public Site:
    Users can view active polls, vote on questions, and see poll results in real-time.

  • Admin Interface:
    Admins can add, update, and delete polls.
    Provides full control over the question and choice setup.

  • Poll Models:
    Question Model: Stores the question text and its publication date.
    Choice Model: Stores the choice text and tracks the number of votes. Each choice is associated with a particular question.

  • Voting System:
    Users select choices in real-time, and the votes are tallied and displayed instantly.

  • Admin Management:
    Django’s built-in admin panel is used to manage polls, providing an easy interface for managing questions and choices.

Tech Stack

  • Framework: Django (Python)

  • Database: SQLite (default Django database)

  • Admin Site: Django’s built-in admin panel for poll management

What I Learned

  • Django Models and ORM: I gained a better understanding of Django's Object-Relational Mapping (ORM) system, which simplifies database interaction. I learned how to design models and manage relationships between them (like between Questions and Choices).

  • Admin Customization: Working with Django’s admin panel helped me understand how to customize admin interfaces, making it easier to manage content.

  • Form Handling and Validation: I learned how Django handles form submissions and how to validate data to ensure user input is stored correctly.

💖 💪 🙅 🚩
p_k
PK

Posted on September 16, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related