@@ -62,6 +62,14 @@ type UsernameCardPublicProfileResponse = {
6262
6363export async function publicRoutes ( app : FastifyInstance ) {
6464 // ─── Public Profile ───
65+ app . get ( '/:username' , {
66+ config : {
67+ rateLimit : {
68+ max : 100 ,
69+ timeWindow : '1 minute'
70+ }
71+ }
72+ } , async ( request : FastifyRequest < { Params : { username : string } } > , reply : FastifyReply ) => {
6573 /**
6674 * GET /api/public/:username
6775 * Returns the public profile information for a user.
@@ -162,7 +170,14 @@ export async function publicRoutes(app: FastifyInstance) {
162170 */
163171 // ─── Shared Card View (Direct) ───
164172
165- app . get ( '/card/:cardId' , async ( request : FastifyRequest < { Params : { cardId : string } } > , reply : FastifyReply ) => {
173+ app . get ( '/card/:cardId' , {
174+ config : {
175+ rateLimit : {
176+ max : 100 ,
177+ timeWindow : '1 minute'
178+ }
179+ }
180+ } , async ( request : FastifyRequest < { Params : { cardId : string } } > , reply : FastifyReply ) => {
166181 const { cardId } = request . params ;
167182
168183 const card = await app . prisma . card . findUnique ( {
@@ -203,6 +218,14 @@ export async function publicRoutes(app: FastifyInstance) {
203218 } ) ;
204219
205220 // ─── Public Card View ───
221+ app . get ( '/:username/card/:cardId' , {
222+ config : {
223+ rateLimit : {
224+ max : 100 ,
225+ timeWindow : '1 minute'
226+ }
227+ }
228+ } , async ( request : FastifyRequest < { Params : { username : string ; cardId : string } } > , reply : FastifyReply ) => {
206229 /**
207230 * GET /api/public/:username/card/:cardId
208231 * Returns full owner profile + specific card data.
@@ -282,7 +305,14 @@ export async function publicRoutes(app: FastifyInstance) {
282305
283306 // ─── QR Code Generation ───
284307
285- app . get ( '/:username/qr' , async ( request : FastifyRequest < {
308+ app . get ( '/:username/qr' , {
309+ config : {
310+ rateLimit : {
311+ max : 50 , // Lower limit for QR generation as it's more resource intensive
312+ timeWindow : '1 minute'
313+ }
314+ }
315+ } , async ( request : FastifyRequest < {
286316 Params : { username : string } ;
287317 Querystring : { format ?: string ; size ?: string } ;
288318 } > , reply : FastifyReply ) => {
0 commit comments