This document describes configuration files and environment setup in AlexJSully's Portfolio project, their roles, technical details, and how to update or extend them.
Configs manage environment variables, service integrations, and global settings for the app. They enable features like Firebase, Sentry error tracking, and custom runtime options.
- Location:
src/configs/ - Example files:
firebase.ts: Firebase configuration and initializationfirebase.test.ts: Test configuration for Firebase
- Related config files:
.env: Environment variables (API keys, secrets)next.config.js: Next.js build/runtime configsentry.client.config.ts,sentry.server.config.ts,sentry.edge.config.ts: Sentry error tracking
import firebaseConfig from '@configs/firebase';
// Initialize Firebase appconst apiKey = process.env.NEXT_PUBLIC_API_KEY;import * as Sentry from '@sentry/nextjs';
Sentry.init({ dsn: process.env.NEXT_PUBLIC_SENTRY_DSN });// next.config.js
module.exports = {
reactStrictMode: true,
env: {
NEXT_PUBLIC_API_KEY: process.env.NEXT_PUBLIC_API_KEY,
},
};- Configs are imported by components, helpers, and backend logic for environment-specific behavior.
- Environment variables are loaded via
.envand referenced in code usingprocess.env.*. - Sentry config files enable error tracking for client, server, and edge runtimes.
- Add new config files in
src/configs/for new services. - Update
.envfor new environment variables. - Document config changes in
README.mdand relevant docs.
💡 Tip: Keep sensitive keys in .env and never commit them to version control. Document all config changes for maintainability.
- Store sensitive keys and secrets in
.env(never commit to git). - Document required environment variables for contributors in README.md or a dedicated section.
- Update config files when adding new services or changing integrations.
- Validate config changes with
npm run validate. - For Sentry, update DSN and environment in all sentry config files and test error reporting.
- Used by data modules, components, and Next.js for service integration.
- Sentry configs for error tracking.
- Firebase config for backend/data features.