All endpoints in this guide are publicly accessible and do not require authentication.
Overview
The Public API provides:- Read-only access to portfolio data
- No authentication required for viewing
- SEO-friendly URLs with slug-based routing
- Contact form functionality for visitors to reach out
Public vs Private Endpoints
| Feature | Public API | Authenticated API |
|---|---|---|
| Base Path | /api/portfolios | /api/me |
| Authentication | None required | JWT token required |
| Access Level | Read-only | Full CRUD |
| Use Case | Portfolio websites | Portfolio management |
Security Configuration
FromSecurityConfig.java:44-50, these endpoints are publicly accessible:
List All Portfolios
Get a summary of all public portfolios:PublicPortfolioController.java:40-44:
Get Portfolio by Slug
Retrieve complete portfolio information using a unique slug:slug: Unique identifier (e.g., “john-doe”)
PublicPortfolioController.java:46-50:
Get Project Details
Retrieve detailed information about a specific project:profileSlug: Portfolio owner’s slug (e.g., “john-doe”)projectSlug: Project’s slug (e.g., “e-commerce-platform”)
PublicPortfolioController.java:52-58:
Contact Form Submission
Allow visitors to send messages through the contact form:slug: Portfolio owner’s slug
ContactRequest.java):
name: Required, max 120 charactersemail: Required, valid email format, max 160 charactersmessage: Required, max 5000 characters
Contact Form Implementation
FromPublicPortfolioController.java:60-79:
Send Email Notification
An email is sent to the portfolio owner’s contact email. See Email Notifications for details.
Building a Portfolio Website
Here’s how to use the Public API to build a portfolio website:Example: React Portfolio
Example: Contact Form Component
CORS Configuration
The API allows cross-origin requests from configured domains. FromSecurityConfig.java:64-85:
application.properties:
Error Responses
- Portfolio Not Found
- Project Not Found
- Validation Error
Status:
404 Not FoundSEO Best Practices
Tips for SEO-friendly portfolio websites:
- Use server-side rendering (SSR) - Fetch data on the server for better SEO
- Generate meta tags dynamically - Use portfolio data for title, description, and Open Graph tags
- Create sitemaps - List all portfolio and project URLs
- Use semantic HTML - Proper heading hierarchy and semantic elements
- Optimize images - Use responsive images with proper alt text
- Implement structured data - Add JSON-LD for Person, CreativeWork, etc.
Example: Next.js SSR
Rate Limiting
Next Steps
Email Notifications
Learn how contact form submissions trigger email notifications
API Reference
View complete API documentation with all endpoints