Skip to content

Instantly share code, notes, and snippets.

URL Shortener Task List

This markdown file outlines a detailed task list for building the URL Shortener project from initial creation to production deployment. The structure is organized into Pull Requests (PRs) as high-level milestones, each containing Epics (feature groups), and each Epic broken down into Commits (granular, atomic tasks). Each task is presented as a TODO checkbox for easy tracking.

This is designed for a solo developer or team using Git for version control. Assume you're working on a main branch, with feature branches for each Epic (e.g., feature/project-setup). Commits should be small and focused, with descriptive messages. After completing an Epic, create a PR to merge into main.

Use tools like GitHub Issues or a simple TODO app to track progress. Estimated times are rough (assuming 4-8 hours/day for a novice).

PR 1: Initial Setup and Core Structure

This PR focuses on bootstrapping the project, setting up the environment, and basic architecture. Goal: A runnable

URL Shortener PRD

Synopsis

This Product Requirements Document (PRD) outlines the requirements for building a URL Shortener microservice. The application allows users to shorten long URLs into compact, shareable links, redirect to the original URL when accessed, and track basic analytics like click counts. Designed as a backend-focused project using Java Spring Boot, it serves as a portfolio piece. The goal is to create a simple, deployable API that demonstrates core backend skills, with instructions clear enough for a novice developer, LLM, or AI assistant to implement from scratch to production.

Executive Summary

The URL Shortener is a lightweight web service inspired by tools like Bitly or TinyURL. It provides RESTful endpoints for creating short URLs, redirecting to originals, and viewing analytics. Key benefits include ease of implementation, scalability potential, and relevance in real-world applications (e.g., marketing, social media). Target users are developers testing APIs or end-users need

🚀 Backend Java Developer Portfolio Projects

This document lists 10 potential portfolio projects designed to showcase backend Java development skills, including Spring Boot APIs, SQL/NoSQL databases, desktop applications, and Docker.


1. Task Manager API

  • Category: Spring Boot REST API
  • Core Features: CRUD for tasks, user authentication, JWT, PostgreSQL persistence
  • Skills Showcased: Spring Boot API design, SQL (Postgres), Dockerized local development

LangGraph Advice for HTML-to-React Project

Why LangGraph > Prompts

  • Modularity: Break your task into nodes (e.g., parse HTML, identify components, generate React code). Update one node for changes, not the whole prompt.
  • State Tracking: Persist data (like parsed HTML) across nodes, avoiding repetitive context in prompts.
  • Control Flow: Use conditional edges or loops to handle varied HTML structures, unlike linear prompts.
  • Debugging: Inspect each node’s output with tools like LangSmith, easier than opaque prompt failures.
  • Tool Integration: Add libraries (e.g., BeautifulSoup) or APIs (e.g., code validation) for robust workflows.

Getting Started

scanf_s Family Functions Reference

Overview

The scanf_s family are secure versions of the standard scanf functions with enhanced security features to prevent buffer overruns. This guide focuses on sscanf_s and swscanf_s for parsing strings.


Function Variants

Windows API Time Structures Reference

Overview

Windows API provides two main structures for handling date and time: FILETIME and SYSTEMTIME. Each serves different purposes in time representation and manipulation.


FILETIME Structure

Tagging Langfuse Conversations for User + Site Conversions

This guide outlines how to tag Langfuse sessions or traces for a user and site when a conversion (e.g., moving from free to paid) occurs, allowing filtering of converted vs. non-converted conversations. Since Langfuse's API doesn't natively support key-based metadata filtering (e.g., site_id), we combine native filters with client-side processing.

Approach

  1. Fetch sessions for a user in a time window (e.g., last 24 hours) using user_id and start_time_after.
  2. Fetch traces for each session using session_id.
  3. Filter traces client-side by metadata.site_id.
  4. Apply a score (e.g., 24h_before_conversion=1) to matching traces or sessions for easy filtering in Langfuse.

Debugging Serverless Lambda 500 Errors

1. Verify Basic Deployment and Connectivity

  • Confirm Endpoints: After serverless deploy, run serverless info to list endpoints and stack outputs. Ensure the URLs match exactly, including the stage (e.g., /dev/).
  • Test with Tools: Use curl -v https://your-endpoint.com/path or Postman to inspect response headers for clues (e.g., CORS or "Internal Server Error").
  • AWS Console Check: Navigate to API Gateway > Your API > Stages and verify no deployment errors or invalid mappings.

2. Inspect Lambda Logs via CloudWatch

This is often the fastest way to identify errors, as 500s typically log stack traces.

  • Enable Logging: In serverless.yml, ensure provider: logs: rest: true for API Gateway.

Ticket 2: Implement StringToFileTime Helper Function

Description

Create a utility function to parse a date string in YYYY-MM-DD format into a FILETIME struct. This will be used for date filtering in later tickets. Test in main() with sample dates, converting and printing success/failure or verifying FILETIME values.

Acceptance Criteria

  • Function signature: bool StringToFileTime(const std::wstring& dateStr, FILETIME& fileTime)
  • Uses swscanf_s for parsing and SystemTimeToFileTime for conversion.
  • Returns false on invalid format.
  • In main(): Test valid and invalid date strings and print results.

Documentation and Summary for std::wstring Constructor and MultiByteToWideChar

std::wstring(size_t count, wchar_t ch)

Summary

The std::wstring(size_t count, wchar_t ch) constructor is a member of the C++ Standard Library's std::basic_string class, specialized for wide characters (wchar_t) as std::wstring. It creates a wide string of length count, where each character is initialized to the specified wide character ch. In the provided code, it is used to allocate a std::wstring of size size - 1 filled with null characters (0) to prepare a buffer for the MultiByteToWideChar conversion.

Documentation

  • Function Signature: std::wstring::basic_string(size_t count, wchar_t ch, const Allocator& alloc = Allocator())
  • Parameters: