Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@radix-ui/react-slot": "^1.2.3",
"class-variance-authority": "^0.7.1",
"clsx": "^2.1.1",
"esbuild": "0.25.8",
"fumadocs-core": "15.6.5",
"fumadocs-mdx": "11.7.0",
"fumadocs-ui": "15.6.5",
Expand All @@ -24,15 +25,18 @@
"ogl": "^1.0.11",
"prettier": "^3.6.2",
"prettier-plugin-tailwindcss": "^0.6.14",
"prismjs": "^1.30.0",
"react": "^19.1.0",
"react-dom": "^19.1.0",
"react-simple-code-editor": "^0.14.1",
"sharp": "^0.34.3",
"tailwind-merge": "^3.3.1"
},
"devDependencies": {
"@tailwindcss/postcss": "^4.1.11",
"@types/mdx": "^2.0.13",
"@types/node": "24.0.15",
"@types/prismjs": "^1.26.5",
"@types/react": "^19.1.8",
"@types/react-dom": "^19.1.6",
"eslint": "^9.31.0",
Expand Down
41 changes: 41 additions & 0 deletions src/app/api/playground/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// src/app/api/run-java/route.ts

import { NextResponse } from 'next/server';

export async function POST(req: Request) {
try {
const { code } = await req.json();

const response = await fetch('https://api.jdoodle.com/v1/execute', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
script: code,
language: 'java',
versionIndex: '3', // Java 11
clientId: '' ,// ← replace with your actual clientId
clientSecret: '', // ← replace with your actual clientSecret
}),
});

const data = await response.json();

return new NextResponse(JSON.stringify({
run: {
output: data.output || 'No output',
},
}), {
status: 200,
headers: { 'Content-Type': 'application/json' },
});

} catch (err) {
console.error(err);
return new NextResponse(JSON.stringify({ error: 'Execution failed' }), {
status: 500,
headers: { 'Content-Type': 'application/json' },
});
}
}
4 changes: 4 additions & 0 deletions src/app/layout.config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export const baseOptions: BaseLayoutProps = {
text: "Sponsors",
url: "/sponsors",
},
{
text: "Playground",
url: "/playground",
}
],
githubUrl: "https://github.com/javaistic/javaistic",
themeSwitch: {
Expand Down
17 changes: 17 additions & 0 deletions src/app/playground/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { baseOptions } from "@/app/layout.config";
import Particles from "@/components/Particles";
import { HomeLayout } from "fumadocs-ui/layouts/home";
import type { ReactNode } from "react";

export default function Layout({ children }: { children: ReactNode }) {
return (
<HomeLayout
{...baseOptions}
style={{
"--spacing-fd-container": "1280px",
} as React.CSSProperties}
>
{children}
</HomeLayout>
);
}
Loading
Loading