Introduction
Virtual Lolly is a fun and innovative JAMstack demo site that allows users to create and send virtual lollipops to brighten someone's day. This project showcases a modern web development approach using pre-rendered content with serverless API fallbacks. It demonstrates how to combine static site generation with dynamic content creation for optimal performance and user experience.
Main Features
- Create and share personalized virtual lollipops
- JAMstack architecture for improved performance and scalability
- Pre-rendered content using Eleventy static site generator
- Serverless API fallbacks for handling new content
- User-generated data stored in Fauna DB
- Deployed and hosted on Netlify
- Custom 404 routing for serving newly created items
- Responsive design for various devices
Installation Steps
Clone the repository:
git clone https://github.com/philhawksworth/virtual-lolly.git
Navigate to the project directory:
cd virtual-lolly
Install dependencies:
npm install
Set up environment variables: Create a
.env
file in the root directory and add necessary API keys and configuration settings.Run the development server:
npm run start
Build the site for production:
npm run build
Usage Instructions
Creating a Virtual Lolly:
- Visit the homepage and click on "Make a new lolly"
- Customize the lolly colors and add a message
- Submit the form to generate a unique URL for your lolly
Sharing a Lolly:
- Copy the generated URL and share it with the recipient
Viewing a Lolly:
- Open the shared URL to see the personalized virtual lolly
Deploying to Netlify:
- Connect your GitHub repository to Netlify
- Configure build settings as specified in
netlify.toml
- Deploy the site
Managing Content:
- New lollies are initially served via the serverless API
- The site rebuilds periodically to include new content in the static render
Important Notes
This project uses Eleventy for static site generation. Familiarize yourself with Eleventy's documentation for customization.
Fauna DB is used for storing user-generated data. Ensure proper setup and security measures for the database.
The serverless functions are crucial for handling new content. Test thoroughly before deployment.
Custom 404 routing on Netlify is key to serving newly created items. Verify this functionality in your deployment settings.
Keep API keys and sensitive information secure. Use environment variables and do not commit them to the repository.
Regular builds are necessary to incorporate new content into the static site. Configure build hooks or scheduled builds on Netlify.
Monitor serverless function usage to manage costs and performance.
Optimize images and assets for faster loading times.
Consider implementing caching strategies for improved performance.
Regularly update dependencies to ensure security and access to new features.