natsumi-h / smartinvoice

Fullstack invoice generator app developed by Next.js/ Prisma/ Planetscale(MySQL)/ Typescript

Home Page:https://smartinvoice-sepia.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

📝SmartInvoice

Smartinvoice is an intuitive application designed for generating professional invoices. It allows users to save their company information, register customer details, and create custom invoices using form inputs. The application features an efficient status management system, viewable through a comprehensive dashboard. Additionally, it supports team collaboration, enabling multiple users to work seamlessly together.

Production URL

https://smartinvoice-sepia.vercel.app

Screenshots

Home(Marketing)

Screenshot 2024-02-25 at 11 36 20 PM

Dashboard

Screenshot 2024-02-25 at 11 36 31 PM

Invoice Detail

Screenshot 2024-02-25 at 11 36 39 PM

Create Invoice

Screenshot 2024-02-25 at 11 36 59 PM

Customers

Screenshot 2024-02-25 at 11 37 08 PM

Customer's Contacts

Screenshot 2024-02-25 at 11 37 18 PM

Technologies Used

Core technologies

Other packeges used

  • jose -JWT signing and encryption
  • Nodemailer -For Email sending
  • AmazonS3 -PDF/Org logo image storage
  • Puppeteer -Headless browser to convert html to PDF
  • dayjs - Date value formatting

Hosting

Documentations

Screenshot 2024-02-28 at 4 19 39 PM

Key Challenges/Takeaways

Server side rendering vs Client side rendering

Soft delete practice

  • Considering the impact on SQL relational tables, practiced using the POST method with manipulation of deleted column for all delete operations, instead of the DELETE.
// POST /api/customer/:id
// @desc: Update a single customer
export async function POST(
  request: Request,
  { params }: { params: { id: string } }
) {
  try {
    await checkIfUserIsLoggedIn();
    const body = await request.json();
    const id = params.id;
    const res = await prisma.customer.update({
      where: {
        id: parseInt(id),
      },
      data: {
        ...body,
        deletedAt: body.deleted ? new Date() : null,
      },
      include: {
        contact: true,
      },
    });
    return NextResponse.json(res, { status: 200 });
  } catch (e: any) {
    const message = e.message || "Failed to update customer";
    const status = e.status || 500;
    return NextResponse.json({ message }, { status });
  }
}

Next Steps

  • UI Enhancement
    • Next.js loading/cache optimization
    • List sort
    • Rich dashboard for data visualization
  • Various cases consideration
    • In case of users belonging to multiple organizations
    • Admin's availability (i.e. Approval for invoice generation by users)
  • Security enhancement
    • More secure Email verification token
    • S3 data protection
  • No-bug application
    • Implement more secure frontend/backend validation
    • Test driven development

References and Inspirations

About

Fullstack invoice generator app developed by Next.js/ Prisma/ Planetscale(MySQL)/ Typescript

https://smartinvoice-sepia.vercel.app


Languages

Language:TypeScript 97.4%Language:CSS 2.2%Language:JavaScript 0.3%