repo stringlengths 7 64 | file_url stringlengths 81 338 | file_path stringlengths 5 257 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:25:31 2026-01-05 01:50:38 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/utils/redirection.ts | api/src/utils/redirection.ts | import jwt from 'jsonwebtoken';
import { availableLangs } from '../../../shared/config/i18n.js';
import { allowedOrigins } from './allowed-origins.js';
// process.env.HOME_LOCATION is being used as a fallback here. If the one
// provided by the client is invalid we default to this.
import { HOME_LOCATION } from './en... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/utils/error-formatting.ts | api/src/utils/error-formatting.ts | import { ErrorObject } from 'ajv';
type FormattedError = {
type: 'error';
message: string;
};
// TODO(Post-MVP): Normalize error responses (either msg or message, not both)
type CodeRoadError = {
type: 'error';
msg: string;
};
const getError = (errors: ErrorObject[]): ErrorObject => {
// This is a guard ag... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/utils/index.ts | api/src/utils/index.ts | import { randomBytes, createHash } from 'crypto';
import { type TypeBoxTypeProvider } from '@fastify/type-provider-typebox';
import {
ContextConfigDefault,
FastifyReply,
RawReplyDefaultExpression,
type FastifyRequest,
type FastifySchema,
type RawRequestDefaultExpression,
type RawServerDefault,
type Rout... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/utils/normalize.ts | api/src/utils/normalize.ts | /* This module's job is to parse the database output and prepare it for
serialization */
import type {
ProfileUI,
CompletedChallenge,
ExamResults,
Survey,
Prisma
} from '@prisma/client';
import { pickBy, mapValues } from 'lodash-es';
type NullToUndefined<T> = T extends null ? undefined : T;
type NullToFalse<... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/utils/ids.ts | api/src/utils/ids.ts | import { customAlphabet } from 'nanoid';
// uppercase, lowercase letters and numbers
export const customNanoid = customAlphabet(
'1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
64
);
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/bouncer.test.ts | api/src/plugins/bouncer.test.ts | /* eslint-disable @typescript-eslint/require-await */
import {
describe,
test,
expect,
beforeEach,
afterEach,
vi,
MockInstance
} from 'vitest';
import Fastify, { type FastifyInstance } from 'fastify';
import { type user } from '@prisma/client';
import { HOME_LOCATION } from '../utils/env.js';
import boun... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/auth0.ts | api/src/plugins/auth0.ts | import fastifyOauth2, { type OAuth2Namespace } from '@fastify/oauth2';
import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox';
import { Type } from 'typebox';
import { Value } from 'typebox/value';
import fp from 'fastify-plugin';
import { isError } from 'lodash-es';
import {
API_LOCATION... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/cors.test.ts | api/src/plugins/cors.test.ts | import { describe, test, expect, beforeAll, afterAll, vi } from 'vitest';
import Fastify, { FastifyInstance, LogLevel } from 'fastify';
import cors from './cors.js';
const NON_DEBUG_LOG_LEVELS: LogLevel[] = [
'fatal',
'error',
'warn',
'info',
'trace'
];
describe('cors', () => {
let fastify: FastifyInstanc... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/growth-book.test.ts | api/src/plugins/growth-book.test.ts | import { describe, test, expect, beforeAll, afterAll, vi } from 'vitest';
import Fastify, { type FastifyInstance } from 'fastify';
import growthBook from './growth-book.js';
vi.mock('../utils/env', async importOriginal => {
const actual = await importOriginal<typeof import('../utils/env.js')>();
return {
...ac... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/auth.test.ts | api/src/plugins/auth.test.ts | import { describe, test, expect, beforeEach, afterEach } from 'vitest';
import Fastify, { FastifyInstance } from 'fastify';
import jwt from 'jsonwebtoken';
import { COOKIE_DOMAIN, JWT_SECRET } from '../utils/env.js';
import { type Token, createAccessToken } from '../utils/tokens.js';
import cookies, {
sign as signCo... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/mailer.ts | api/src/plugins/mailer.ts | import type { FastifyPluginCallback } from 'fastify';
import fp from 'fastify-plugin';
declare module 'fastify' {
interface FastifyInstance {
sendEmail: SendEmail;
}
}
export type SendEmailArgs = {
to: string;
from: string;
subject: string;
text: string;
cc?: string;
};
type SendEmail = (args: Send... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/csrf.ts | api/src/plugins/csrf.ts | import type { FastifyPluginCallback } from 'fastify';
import fastifyCsrfProtection from '@fastify/csrf-protection';
import fp from 'fastify-plugin';
export const CSRF_COOKIE = 'csrf_token';
export const CSRF_HEADER = 'csrf-token';
export const CSRF_SECRET_COOKIE = '_csrf';
/**
* Plugin for preventing CSRF attacks.
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/shadow-capture.ts | api/src/plugins/shadow-capture.ts | import { randomUUID } from 'crypto';
import { appendFileSync, mkdirSync } from 'fs';
import { join } from 'path';
import type {
FastifyPluginCallback,
FastifyReply,
FastifyRequest
} from 'fastify';
import fp from 'fastify-plugin';
const LOGS_DIRECTORY = 'logs';
const REQUEST_CAPTURE_FILE = 'request-capture.json... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/not-found.test.ts | api/src/plugins/not-found.test.ts | import { describe, beforeEach, afterEach, it, expect } from 'vitest';
import Fastify, { type FastifyInstance } from 'fastify';
import accepts from '@fastify/accepts';
import notFound from './not-found.js';
import redirectWithMessage, { formatMessage } from './redirect-with-message.js';
describe('fourOhFour', () => {
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/cookies.ts | api/src/plugins/cookies.ts | import fastifyCookie, { type UnsignResult } from '@fastify/cookie';
import { FastifyPluginCallback } from 'fastify';
import fp from 'fastify-plugin';
import {
COOKIE_DOMAIN,
COOKIE_SECRET,
FREECODECAMP_NODE_ENV
} from '../utils/env.js';
import { CSRF_COOKIE, CSRF_SECRET_COOKIE } from './csrf.js';
export { type ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/cookie-update.ts | api/src/plugins/cookie-update.ts | import { FastifyPluginCallback } from 'fastify';
import type { CookieSerializeOptions } from './cookies.js';
type Options = { cookies: string[]; attributes: CookieSerializeOptions };
/**
* Plugin that updates the attributes of cookies in the response, without
* changing the value.
*
* @param fastify The Fastify ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/mailer.test.ts | api/src/plugins/mailer.test.ts | import { describe, test, expect, vi } from 'vitest';
import Fastify from 'fastify';
import mailer from './mailer.js';
describe('mailer', () => {
test('should send an email via the provider', async () => {
const fastify = Fastify();
const send = vi.fn();
await fastify.register(mailer, { provider: { send ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/redirect-with-message.test.ts | api/src/plugins/redirect-with-message.test.ts | import { describe, test, expect, beforeEach } from 'vitest';
import Fastify, { FastifyInstance } from 'fastify';
import qs from 'query-string';
import redirectWithMessage from './redirect-with-message.js';
async function setupServer() {
const fastify = Fastify();
await fastify.register(redirectWithMessage);
ret... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/error-handling.ts | api/src/plugins/error-handling.ts | import type { FastifyPluginCallback } from 'fastify';
import * as Sentry from '@sentry/node';
import fp from 'fastify-plugin';
import { getRedirectParams } from '../utils/redirection.js';
declare module 'fastify' {
interface FastifyInstance {
Sentry: typeof Sentry;
}
}
/**
* Plugin to handle errors and send... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/bouncer.ts | api/src/plugins/bouncer.ts | import type {
FastifyPluginCallback,
FastifyRequest,
FastifyReply
} from 'fastify';
import fp from 'fastify-plugin';
import { getRedirectParams } from '../utils/redirection.js';
declare module 'fastify' {
interface FastifyInstance {
send401IfNoUser: (req: FastifyRequest, reply: FastifyReply) => void;
r... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/cookies.test.ts | api/src/plugins/cookies.test.ts | import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest';
import Fastify, { type FastifyInstance } from 'fastify';
import fastifyCookie from '@fastify/cookie';
import { COOKIE_SECRET } from '../utils/env.js';
import cookies from './cookies.js';
vi.mock('../utils/env', async importOriginal => {
con... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/redirect-with-message.ts | api/src/plugins/redirect-with-message.ts | import { FastifyPluginCallback, type FastifyReply } from 'fastify';
import fp from 'fastify-plugin';
// TODO: (POST MVP)use node's querystring and just JSON stringify the message.
// No need for query-string on either side.
import qs from 'query-string';
declare module 'fastify' {
interface FastifyReply {
redire... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/auth.ts | api/src/plugins/auth.ts | import { FastifyPluginCallback, FastifyRequest, FastifyReply } from 'fastify';
import fp from 'fastify-plugin';
import jwt from 'jsonwebtoken';
import { type user } from '@prisma/client';
import { JWT_SECRET } from '../utils/env.js';
import { type Token, isExpired } from '../utils/tokens.js';
import { ERRORS } from '.... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/not-found.ts | api/src/plugins/not-found.ts | import type { FastifyPluginCallback } from 'fastify';
import fp from 'fastify-plugin';
import { getRedirectParams } from '../utils/redirection.js';
/**
* Plugin for handling missing endpoints.
*
* @param fastify The Fastify instance.
* @param _options Options passed to the plugin via `fastify.register(plugin, op... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/auth-dev.ts | api/src/plugins/auth-dev.ts | import type { FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox';
import type { FastifyReply, FastifyRequest } from 'fastify';
import {
getRedirectParams,
getPrefixedLandingPath,
haveSamePath
} from '../utils/redirection.js';
import { findOrCreateUser } from '../routes/helpers/auth-helpers.js';
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/auth0.test.ts | api/src/plugins/auth0.test.ts | import {
describe,
test,
expect,
beforeAll,
afterAll,
beforeEach,
afterEach,
vi,
MockInstance
} from 'vitest';
import Fastify, { FastifyInstance } from 'fastify';
import { createUserInput } from '../utils/create-user.js';
import { AUTH0_DOMAIN, HOME_LOCATION } from '../utils/env.js';
import prismaPlu... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/csrf.test.ts | api/src/plugins/csrf.test.ts | import { describe, test, expect, beforeEach, vi } from 'vitest';
import Fastify, { type FastifyInstance } from 'fastify';
import { COOKIE_DOMAIN } from '../utils/env.js';
import cookies from './cookies.js';
import csrf, { CSRF_COOKIE, CSRF_SECRET_COOKIE } from './csrf.js';
vi.mock('../utils/env', async importOriginal... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/auth-dev.test.ts | api/src/plugins/auth-dev.test.ts | import {
describe,
test,
expect,
beforeAll,
beforeEach,
afterAll
} from 'vitest';
import Fastify, { FastifyInstance } from 'fastify';
import { checkCanConnectToDb, defaultUserEmail } from '../../vitest.utils.js';
import { HOME_LOCATION } from '../utils/env.js';
import { devAuth } from '../plugins/auth-dev.... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/security.ts | api/src/plugins/security.ts | import { FastifyPluginCallback } from 'fastify';
import fp from 'fastify-plugin';
import { FREECODECAMP_NODE_ENV } from '../utils/env.js';
const securityHeaders: FastifyPluginCallback = (fastify, _options, done) => {
// OWASP recommended headers
fastify.addHook('onRequest', async (req, reply) => {
void reply
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/cookie-update.test.ts | api/src/plugins/cookie-update.test.ts | import { describe, test, expect, beforeEach, afterEach, vi } from 'vitest';
import Fastify, { FastifyInstance } from 'fastify';
import cookies, { type CookieSerializeOptions, sign } from './cookies.js';
import { cookieUpdate } from './cookie-update.js';
vi.mock('../utils/env', async importOriginal => {
const actual ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/cors.ts | api/src/plugins/cors.ts | import { FastifyPluginCallback } from 'fastify';
import fp from 'fastify-plugin';
import { HOME_LOCATION } from '../utils/env.js';
import { allowedOrigins } from '../utils/allowed-origins.js';
const cors: FastifyPluginCallback = (fastify, _options, done) => {
fastify.options('*', (_req, reply) => {
void reply.s... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/error-handling.test.ts | api/src/plugins/error-handling.test.ts | import {
describe,
test,
expect,
beforeEach,
afterEach,
beforeAll,
afterAll,
vi
} from 'vitest';
import Fastify, { FastifyError, type FastifyInstance } from 'fastify';
import accepts from '@fastify/accepts';
import { http, HttpResponse } from 'msw';
import { setupServer } from 'msw/node';
vi.mock('../u... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/growth-book.ts | api/src/plugins/growth-book.ts | import { GrowthBook, Options } from '@growthbook/growthbook';
import { FastifyPluginAsync } from 'fastify';
import fp from 'fastify-plugin';
import { FREECODECAMP_NODE_ENV } from '../utils/env.js';
declare module 'fastify' {
interface FastifyInstance {
gb: GrowthBook;
}
}
const growthBook: FastifyPluginAsync... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/mail-providers/nodemailer.ts | api/src/plugins/mail-providers/nodemailer.ts | import nodemailer, { Transporter } from 'nodemailer';
import { MailProvider, SendEmailArgs } from '../mailer.js';
import { MAILPIT_HOST } from '../../utils/env.js';
/**
* NodemailerProvider is a wrapper around nodemailer that provides a clean
* interface for sending email.
*/
export class NodemailerProvider implem... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/mail-providers/ses.ts | api/src/plugins/mail-providers/ses.ts | import {
SESClient,
SESClientConfig,
SendEmailCommand
} from '@aws-sdk/client-ses';
import { MailProvider, SendEmailArgs } from '../mailer.js';
import { SES_ID, SES_SECRET, SES_REGION } from '../../utils/env.js';
/**
* SESProvider is a wrapper around nodemailer that provides a clean interface
* for sending em... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/plugins/__fixtures__/user.ts | api/src/plugins/__fixtures__/user.ts | import { expect } from 'vitest';
import { nanoidCharSet } from '../../utils/create-user.js';
const uuidRe = /^[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$/;
const fccUuidRe = /^fcc-[a-f0-9]{8}-([a-f0-9]{4}-){3}[a-f0-9]{12}$/;
const unsubscribeIdRe = new RegExp(`^[${nanoidCharSet}]{21}$`);
const mongodbIdRe = /^[a-f0-9]... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/daily-coding-challenge/schemas/daily-coding-challenge.ts | api/src/daily-coding-challenge/schemas/daily-coding-challenge.ts | import { Type } from '@fastify/type-provider-typebox';
const challengeLanguage = Type.Object({
tests: Type.Array(
Type.Object({
text: Type.String(),
testString: Type.String()
})
),
challengeFiles: Type.Array(
Type.Object({
contents: Type.String(),
fileKey: Type.String()
})... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/daily-coding-challenge/schemas/index.ts | api/src/daily-coding-challenge/schemas/index.ts | export { dailyCodingChallenge } from './daily-coding-challenge.js';
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/daily-coding-challenge/routes/daily-coding-challenge.ts | api/src/daily-coding-challenge/routes/daily-coding-challenge.ts | import { type FastifyPluginCallbackTypebox } from '@fastify/type-provider-typebox';
import * as schemas from '../schemas/index.js';
import {
getNowUsCentral,
getUtcMidnight,
dateStringToUtcMidnight
} from '../utils/helpers.js';
/**
* Plugin containing public GET routes for the daily coding challenges.
* Note ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/daily-coding-challenge/routes/daily-coding-challenge.test.ts | api/src/daily-coding-challenge/routes/daily-coding-challenge.test.ts | import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
import { addDays } from 'date-fns';
import { setupServer, superRequest } from '../../../vitest.utils.js';
function dateToDateParam(date: Date): string {
return date.toISOString().split('T')[0] as string;
}
const todayUsCentral = new Date(Dat... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/src/daily-coding-challenge/utils/helpers.ts | api/src/daily-coding-challenge/utils/helpers.ts | import { getTimezoneOffset } from 'date-fns-tz';
/**
* @returns Now US Central time.
*/
export function getNowUsCentral() {
const offset = getTimezoneOffset('America/Chicago', new Date());
return new Date(Date.now() + offset);
}
/**
* Returns a Date object set to UTC midnight of the given date.
* @param date ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/__mocks__/exam.ts | api/__mocks__/exam.ts | import { expect } from 'vitest';
export const examChallengeId = '647e22d18acb466c97ccbef8';
export const examJson = {
id: examChallengeId,
title: 'Exam Certification',
numberOfQuestionsInExam: 3,
passingPercent: 10,
prerequisites: [
{
id: '647f85d407d29547b3bee1bb',
title: 'challenge-title'
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/api/__mocks__/exam-environment-exam.ts | api/__mocks__/exam-environment-exam.ts | /* eslint-disable jsdoc/require-jsdoc */
import { Static } from '@fastify/type-provider-typebox';
import {
ExamEnvironmentConfig,
ExamEnvironmentQuestionType,
ExamEnvironmentExamAttempt,
ExamEnvironmentExam,
ExamEnvironmentGeneratedExam,
ExamEnvironmentQuestionSet,
ExamEnvironmentChallenge
} from '@prisma... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/generate-search-placeholder.ts | client/tools/generate-search-placeholder.ts | import { writeFileSync, readdirSync, lstatSync } from 'fs';
import { join, resolve } from 'path';
import algoliasearch from 'algoliasearch';
import i18n from 'i18next';
import backend from 'i18next-fs-backend';
import {
algoliaAppId,
algoliaAPIKey,
clientLocale,
environment
} from '../config/env.json';
import ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/download-trending.ts | client/tools/download-trending.ts | import { readFileSync, writeFileSync } from 'fs';
import path from 'path';
import fetch from 'node-fetch';
import yaml from 'js-yaml';
import { config } from 'dotenv';
import { trendingSchemaValidator } from './schema/trending-schema';
config({ path: path.resolve(__dirname, '../../.env') });
const createCdnUrl = (l... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/read-env.ts | client/tools/read-env.ts | import path from 'path';
import { config } from 'dotenv';
const envPath = path.resolve(__dirname, '../../.env');
const { error } = config({ path: envPath });
if (error) {
console.warn(`
----------------------------------------------------
Warning: .env file not found.
-----------------------------------------... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/generate-search-placeholder.test.ts | client/tools/generate-search-placeholder.test.ts | import { describe, test, expect } from 'vitest';
import { clientLocale } from '../config/env.json';
import {
convertToLocalizedString,
generateSearchPlaceholder,
roundDownToNearestHundred
} from './generate-search-placeholder';
describe('Search bar placeholder tests:', () => {
describe('Number rounding', () =... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/create-env.ts | client/tools/create-env.ts | import { spawn } from 'child_process';
import * as fs from 'fs';
import * as path from 'path';
import { availableLangs, Languages } from '../../shared-dist/config/i18n';
import env from './read-env';
const configPath = path.resolve(__dirname, '../config');
const { FREECODECAMP_NODE_ENV } = process.env;
function che... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/external-data-schema-v1.ts | client/tools/external-curriculum/external-data-schema-v1.ts | import Joi from 'joi';
import { chapterBasedSuperBlocks } from '../../../shared-dist/config/curriculum';
const blockSchema = Joi.object({}).keys({
desc: Joi.array().min(1),
challenges: Joi.object({})
.keys({
name: Joi.string().required(),
isUpcomingChange: Joi.bool().required(),
usesMultifile... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/build-external-curricula-data-v2.test.ts | client/tools/external-curriculum/build-external-curricula-data-v2.test.ts | import path from 'path';
import fs, { readFileSync } from 'fs';
import readdirp from 'readdirp';
import { describe, test, expect } from 'vitest';
import {
chapterBasedSuperBlocks,
SuperBlocks,
SuperBlockStage,
superBlockStages
} from '../../../shared-dist/config/curriculum';
import {
superblockSchemaValidat... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/build-external-curricula-data-v2.ts | client/tools/external-curriculum/build-external-curricula-data-v2.ts | import { mkdirSync, writeFileSync, readFileSync } from 'fs';
import { resolve, dirname } from 'path';
import { omit } from 'lodash';
import { submitTypes } from '../../../shared-dist/config/challenge-types';
import { type ChallengeNode } from '../../src/redux/prop-types';
import {
SuperBlocks,
chapterBasedSuperBloc... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/patches.ts | client/tools/external-curriculum/patches.ts | export const patchBlock = (meta: Record<string, unknown>) => {
const { blockLabel, ...rest } = meta;
return {
...rest,
blockType: blockLabel
};
};
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/build.ts | client/tools/external-curriculum/build.ts | import { readFileSync } from 'node:fs';
import { join } from 'node:path';
const CURRICULUM_PATH = '../../../shared-dist/config/curriculum.json';
// const __dirname = dirname(fileURLToPath(import.meta.url));
// Curriculum is read using fs, because it is too large for VSCode's LSP to handle type inference which causes a... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/external-data-schema-v2.ts | client/tools/external-curriculum/external-data-schema-v2.ts | import Joi from 'joi';
import { chapterBasedSuperBlocks } from '../../../shared-dist/config/curriculum';
const slugRE = new RegExp('^[a-z0-9-]+$');
const blockSchema = Joi.object().keys({
intro: Joi.array().min(1),
meta: Joi.object({})
.keys({
name: Joi.string().required(),
isUpcomingChange: Joi.b... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/build-external-curricula-data-v1.test.ts | client/tools/external-curriculum/build-external-curricula-data-v1.test.ts | import path from 'path';
import fs from 'fs';
import readdirp from 'readdirp';
import { describe, test, expect } from 'vitest';
import intros from '../../i18n/locales/english/intro.json';
import {
SuperBlocks,
SuperBlockStage,
superBlockStages
} from '../../../shared-dist/config/curriculum';
import {
superblo... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/external-curriculum/build-external-curricula-data-v1.ts | client/tools/external-curriculum/build-external-curricula-data-v1.ts | import { mkdirSync, writeFileSync, readFileSync } from 'fs';
import { resolve, dirname } from 'path';
import { omit } from 'lodash';
import { submitTypes } from '../../../shared-dist/config/challenge-types';
import { SuperBlocks } from '../../../shared-dist/config/curriculum';
import { patchBlock } from './patches';
e... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/tools/schema/trending-schema.ts | client/tools/schema/trending-schema.ts | import Joi from 'joi';
const schema = Joi.object().keys({
article0title: Joi.string().required(),
article0link: Joi.string().uri({ scheme: 'https' }).required(),
article1title: Joi.string().required(),
article1link: Joi.string().uri({ scheme: 'https' }).required(),
article2title: Joi.string().required(),
a... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/html.tsx | client/src/html.tsx | import React from 'react';
import { clientLocale } from '../config/env.json';
import { rtlLangs } from '../../shared-dist/config/i18n';
interface HTMLProps {
body: string;
bodyAttributes?: Record<string, unknown>;
headComponents?: React.ReactNode[];
htmlAttributes?: Record<string, unknown>;
postBodyComponent... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/i18next.d.ts | client/src/i18next.d.ts | import 'i18next';
// This should not be necessary when upgrading to v23.0.0
declare module 'i18next' {
interface CustomTypeOptions {
returnNull: false;
}
}
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/declarations.d.ts | client/src/declarations.d.ts | declare module '@freecodecamp/loop-protect';
declare module '@freecodecamp/strip-comments';
declare module '@types/react-redux';
declare module '@types/validator';
declare module '@types/lodash-es';
declare module '*.svg' {
const content: string;
export default content;
}
declare module '*.woff' {
const url: stri... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/reset.d.ts | client/src/reset.d.ts | import '@total-typescript/ts-reset';
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/redux/actions.ts | client/src/redux/actions.ts | import { createAction } from 'redux-actions';
import { actionTypes } from './action-types';
export const appMount = createAction(actionTypes.appMount);
export const tryToShowDonationModal = createAction(
actionTypes.tryToShowDonationModal
);
export const allowSectionDonationRequests = createAction(
actionTypes.... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/redux/root-saga.ts | client/src/redux/root-saga.ts | import { all } from 'redux-saga/effects';
import { sagas as challengeSagas } from '../templates/Challenges/redux';
import errorSagas from './error-saga';
import { sagas as settingsSagas } from './settings';
import { sagas as appSagas } from '.';
export default function* rootSaga() {
yield all([...errorSagas, ...app... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/redux/prop-types.ts | client/src/redux/prop-types.ts | import { HandlerProps } from 'react-reflex';
import type {
ChallengeLang,
SuperBlocks
} from '../../../shared-dist/config/curriculum';
import type { CertificationFlags } from '../../../shared-dist/config/certification-settings';
import type { Chapter } from '../../../shared-dist/config/chapters';
import { BlockLayo... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/redux/root-epic.ts | client/src/redux/root-epic.ts | import { combineEpics } from 'redux-observable';
import { epics as challengeEpics } from '../templates/Challenges/redux';
import { epics as appEpics } from '.';
const rootEpic = combineEpics(...appEpics, ...challengeEpics);
export default rootEpic;
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/redux/create-store.ts | client/src/redux/create-store.ts | import { createEpicMiddleware } from 'redux-observable';
import createSagaMiddleware from 'redux-saga';
import { configureStore } from '@reduxjs/toolkit';
import { isBrowser } from '../../utils';
import {
examAttempts,
examEnvironmentAuthorizationTokenApi
} from '../utils/ajax';
import rootEpic from './root-epic';... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/redux/types.ts | client/src/redux/types.ts | import { FlashMessages } from '../components/Flash/redux/flash-messages';
import { ns as MainApp } from './action-types';
export const FlashApp = 'flash';
export type FlashMessageArg = {
type: string;
message: FlashMessages;
variables?: Record<string, unknown>;
};
export interface State {
[FlashApp]: FlashSt... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/redux/root-reducer.ts | client/src/redux/root-reducer.ts | import { combineReducers } from 'redux';
import { reducer as flash } from '../components/Flash/redux';
import {
ns as searchNameSpace,
reducer as search
} from '../components/search/redux';
import {
ns as challengeNameSpace,
reducer as challenge
} from '../templates/Challenges/redux';
import {
ns as curricul... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/user.tsx | client/src/pages/user.tsx | import { Router } from '@gatsbyjs/reach-router';
import { withPrefix } from 'gatsby';
import React from 'react';
import ShowUser from '../client-only-routes/show-user';
import RedirectHome from '../components/redirect-home';
function User(): JSX.Element {
return (
<Router>
{/* @ts-expect-error Adding path... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/supporters.tsx | client/src/pages/supporters.tsx | import React from 'react';
import Helmet from 'react-helmet';
import { withTranslation, useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { Container, Row, Col, Spacer } from '@freecodecamp/ui';
import BigCallToAction from '../components/land... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/donate.tsx | client/src/pages/donate.tsx | import { Container, Col, Row, Spacer } from '@freecodecamp/ui';
import type { TFunction } from 'i18next';
import React, { useEffect } from 'react';
import Helmet from 'react-helmet';
import { withTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
impor... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/challenges.test.tsx | client/src/pages/challenges.test.tsx | import {
createHistory,
createMemorySource,
LocationProvider
} from '@gatsbyjs/reach-router';
import { render } from '@testing-library/react';
import { navigate, withPrefix } from 'gatsby';
import React from 'react';
import { describe, it, expect } from 'vitest';
import Challenges from './challenges';
describe(... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/challenges.tsx | client/src/pages/challenges.tsx | // This exists purely to redirect legacy challenge paths to /learn that could
// exist in the web (posts, url shares, etc).
import { Router, RouteComponentProps } from '@gatsbyjs/reach-router';
import { navigate, withPrefix } from 'gatsby';
import React from 'react';
import toLearnPath from '../utils/to-learn-path';
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/catalog.tsx | client/src/pages/catalog.tsx | import React from 'react';
import { useTranslation } from 'react-i18next';
import { Col, Spacer } from '@freecodecamp/ui';
import { ButtonLink } from '../components/helpers';
import { catalog } from '../../../shared-dist/config/catalog';
import { showUpcomingChanges } from '../../config/env.json';
import FourOhFour fro... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/404.tsx | client/src/pages/404.tsx | /* eslint-disable filenames-simple/naming-convention */
import { Router } from '@gatsbyjs/reach-router';
import { withPrefix } from 'gatsby';
import React from 'react';
import ShowProfileOrFourOhFour from '../client-only-routes/show-profile-or-four-oh-four';
import FourOhFour from '../components/FourOhFour';
function... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/update-stripe-card.tsx | client/src/pages/update-stripe-card.tsx | import { useLocation } from '@gatsbyjs/reach-router';
import React, { type FormEvent, useEffect } from 'react';
import Helmet from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { Container, Row, Col, Button, Spac... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/index.tsx | client/src/pages/index.tsx | import React from 'react';
import { useTranslation } from 'react-i18next';
import { useGrowthBook } from '@growthbook/growthbook-react';
import SEO from '../components/seo';
import { Loader } from '../components/helpers';
import LandingTop from '../components/landing/components/landing-top';
import Testimonials from '.... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/update-email.tsx | client/src/pages/update-email.tsx | import { Router } from '@gatsbyjs/reach-router';
import { withPrefix } from 'gatsby';
import React from 'react';
import ShowUpdateEmail from '../client-only-routes/show-update-email';
import RedirectHome from '../components/redirect-home';
function UpdateEmail(): JSX.Element {
return (
<Router>
<ShowUpdat... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/email-sign-up.tsx | client/src/pages/email-sign-up.tsx | import React from 'react';
import Helmet from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { Container, Spacer } from '@freecodecamp/ui';
import createRedirect from '../components/create-redirect';
import { Load... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/learn.tsx | client/src/pages/learn.tsx | import { graphql } from 'gatsby';
import React from 'react';
import Helmet from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';
import { Container, Col, Row, Spacer } from '@freecodecamp/ui';
import Intro from '../compone... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/settings.tsx | client/src/pages/settings.tsx | import { Router } from '@gatsbyjs/reach-router';
import { withPrefix } from 'gatsby';
import React from 'react';
import ShowSettings from '../client-only-routes/show-settings';
import RedirectHome from '../components/redirect-home';
function Settings(): JSX.Element {
return (
<Router>
<ShowSettings path={... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/blocked.tsx | client/src/pages/blocked.tsx | import React from 'react';
import Helmet from 'react-helmet';
import { Container, Col, Row, Spacer } from '@freecodecamp/ui';
function BlockedPage(): JSX.Element {
return (
<>
<Helmet title={`Access Denied | freeCodeCamp.org`} />
<Container className='text-center'>
<Spacer size='l' />
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/unsubscribed.tsx | client/src/pages/unsubscribed.tsx | import { Router } from '@gatsbyjs/reach-router';
import { withPrefix } from 'gatsby';
import React from 'react';
import ShowUnsubscribed from '../client-only-routes/show-unsubscribed';
import RedirectHome from '../components/redirect-home';
function Unsubscribed(): JSX.Element {
return (
<Router>
<ShowUns... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/certification.tsx | client/src/pages/certification.tsx | import { Router } from '@gatsbyjs/reach-router';
import { withPrefix } from 'gatsby';
import React from 'react';
import ShowCertification from '../client-only-routes/show-certification';
import RedirectHome from '../components/redirect-home';
import './certification.css';
function Certification(): JSX.Element {
re... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/status/version.test.tsx | client/src/pages/status/version.test.tsx | import { render, screen } from '@testing-library/react';
import React from 'react';
import { describe, it, expect, beforeEach, vi } from 'vitest';
import VersionEndpoint from './version';
interface VersionData {
client: {
version: string;
};
api: {
version: string;
error?: string;
};
}
// Mock th... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/status/version.tsx | client/src/pages/status/version.tsx | import React, { useEffect, useState } from 'react';
import { getVersionObject } from '../../utils/version';
import envData from '../../../config/env.json';
interface VersionData {
client: {
version: string;
};
api: {
version: string;
error?: string;
};
}
const VersionEndpoint = () => {
const [ve... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/learn/archive.tsx | client/src/pages/learn/archive.tsx | import React from 'react';
import { useTranslation } from 'react-i18next';
import { Container, Row, Col, Spacer } from '@freecodecamp/ui';
import Helmet from 'react-helmet';
import LearnLayout from '../../components/layouts/learn';
import { ArchiveMap } from '../../components/Map';
import CalendarIcon from '../../asse... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/learn/daily-coding-challenge/[...].tsx | client/src/pages/learn/daily-coding-challenge/[...].tsx | /* eslint-disable filenames-simple/naming-convention */
import { Router } from '@gatsbyjs/reach-router';
import { withPrefix } from 'gatsby';
import React from 'react';
import ShowDailyCodingChallenge from '../../../client-only-routes/show-daily-coding-challenge';
import RedirectToArchive from '../../../components/red... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/pages/learn/daily-coding-challenge/archive.tsx | client/src/pages/learn/daily-coding-challenge/archive.tsx | import React from 'react';
import { useTranslation } from 'react-i18next';
import { Container, Col, Row, Spacer } from '@freecodecamp/ui';
import Map from '../../../components/Map';
import DailyCodingChallengeCalendar from '../../../components/daily-coding-challenge/calendar';
import DailyCodingChallengeIcon from '../.... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/redirect-home.ts | client/src/components/redirect-home.ts | import { withPrefix } from 'gatsby';
import createRedirect from './create-redirect';
export default createRedirect(withPrefix('/'));
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/email-options.tsx | client/src/components/email-options.tsx | import React from 'react';
import { useTranslation } from 'react-i18next';
import { Col, Row, Button, Spacer } from '@freecodecamp/ui';
import { apiLocation } from '../../config/env.json';
interface EmailListOptInProps {
isSignedIn: boolean;
updateQuincyEmail: (isSendQuincyEmail: boolean) => void;
}
export functi... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/app-mount-notifier.tsx | client/src/components/app-mount-notifier.tsx | import React, { useEffect } from 'react';
import { Helmet } from 'react-helmet';
import { useTranslation } from 'react-i18next';
import { connect } from 'react-redux';
import { bindActionCreators, Dispatch } from 'redux';
import { appMount } from '../redux/actions';
interface AppMountNotifierProps {
children: React... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/create-redirect.ts | client/src/components/create-redirect.ts | import { navigate } from 'gatsby';
import type { RouteComponentProps } from '@gatsbyjs/reach-router';
const createRedirect =
(to = '/'): ((_props: RouteComponentProps) => JSX.Element | null) =>
() => {
if (typeof window !== 'undefined') {
void navigate(to);
}
return null;
};
export default cre... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/webmanifest.tsx | client/src/components/webmanifest.tsx | import React from 'react';
import { withPrefix } from 'gatsby';
export const webmanifestComponents: JSX.Element[] = [
<link
rel='icon'
href={withPrefix('/favicon-32x32.png')}
type='image/png'
key='favicon-32x32'
/>,
<link
rel='manifest'
href={withPrefix('/manifest.webmanifest')}
cross... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/app-mount-notifier.test.tsx | client/src/components/app-mount-notifier.test.tsx | import { render, waitFor } from '@testing-library/react';
import React from 'react';
import { I18nextProvider } from 'react-i18next';
import { Provider } from 'react-redux';
import { describe, vi, test, expect } from 'vitest';
import { i18nextCodes } from '../../../shared-dist/config/i18n';
import i18nTestConfig from ... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/create-language-redirect.test.ts | client/src/components/create-language-redirect.test.ts | // @vitest-environment jsdom
import { beforeEach, describe, expect, it } from 'vitest';
import createLanguageRedirect from './create-language-redirect';
describe('createLanguageRedirect for clientLocale === english', () => {
const envVars = {
clientLocale: 'english'
};
describe('challenge page', () => {
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/redirect-daily-challenge-archive.tsx | client/src/components/redirect-daily-challenge-archive.tsx | import { withPrefix } from 'gatsby';
import createRedirect from './create-redirect';
export default createRedirect(
withPrefix('/learn/daily-coding-challenge/archive')
);
| typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/create-language-redirect.ts | client/src/components/create-language-redirect.ts | const createLanguageRedirect = ({
clientLocale,
lang
}: {
clientLocale: string;
lang: string;
}): string => {
// return early if requesting the same page
if (clientLocale === lang) return window?.location.toString();
const pathArray = window?.location?.pathname?.split('/');
const path = pathArray
.... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/solution-display-widget/index.tsx | client/src/components/solution-display-widget/index.tsx | import React from 'react';
import { faExternalLinkAlt } from '@fortawesome/free-solid-svg-icons';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { Dropdown, MenuItem, Button } from '@freecodecamp/ui';
import { useTranslation } from 'react-i18next';
import { CompletedChallenge } from '../../re... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
freeCodeCamp/freeCodeCamp | https://github.com/freeCodeCamp/freeCodeCamp/blob/7d58ef2062b457d9370a7f730fc875f92ad28a80/client/src/components/share/share-template.test.tsx | client/src/components/share/share-template.test.tsx | import React from 'react';
import { render, screen } from '@testing-library/react';
import { describe, test, expect } from 'vitest';
import { ShareTemplate } from './share-template';
const redirectURL = 'string';
describe('Share Template Testing', () => {
render(
<ShareTemplate
xRedirectURL={redirectURL}
... | typescript | BSD-3-Clause | 7d58ef2062b457d9370a7f730fc875f92ad28a80 | 2026-01-04T15:25:31.297347Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.