"""
return BASE_LAYOUT.replace("{{STYLE}}", BASE_STYLE).replace("{{APP_NAME}}", APP_NAME).replace("{{TAGLINE}}", TAGLINE).replace("{{ACCENT_COLOR}}", ACCENT_COLOR).replace("{{PRIMARY_COLOR}}", PRIMARY_COLOR).replace("{{page_title}}", "Cancelled").replace("{{CONTENT}}", content).replace("{{BMAC_FOOTER}}", BMAC_FOOTER).replace("{{year}}", str(datetime.now().year))
# ─── ROUTES: Dashboard ────────────────────────────────────
@app.route('/dashboard')
@login_required
def dashboard():
db = get_db()
user = db.execute("SELECT * FROM users WHERE id=?", (session['user_id'],)).fetchone()
results = db.execute("SELECT * FROM results WHERE user_id=? ORDER BY created_at DESC LIMIT 10", (session['user_id'],)).fetchall()
db.close()
premium_badge = 'PREMIUM' if user['is_premium'] else ''
upgrade_btn = 'Upgrade to Premium' if not user['is_premium'] else ''
results_html = ''
for r in results:
results_html += '
' + str(r['data'])[:200] + '
' + r['created_at'] + '
'
empty_msg = '
No results yet. Use the tool above to get started!
' if not results else ''
content = """
Dashboard """ + premium_badge + """
""" + upgrade_btn + """
Welcome back, """ + user['email'] + """
Get Started
Paste a job description and InterviewForge forges tailored technical, behavioral, and follow-up questions.
Recent Results
""" + empty_msg + """
""" + results_html + """
"""
return BASE_LAYOUT.replace("{{STYLE}}", BASE_STYLE).replace("{{APP_NAME}}", APP_NAME).replace("{{TAGLINE}}", TAGLINE).replace("{{ACCENT_COLOR}}", ACCENT_COLOR).replace("{{PRIMARY_COLOR}}", PRIMARY_COLOR).replace("{{page_title}}", "Dashboard").replace("{{CONTENT}}", content).replace("{{BMAC_FOOTER}}", BMAC_FOOTER).replace("{{year}}", str(datetime.now().year))
# ─── CORE FEATURE ENGINE (stdlib only) ─────────────────────
SKILL_MAP = {
"python": ["Walk me through a Python project you built and what you would refactor.",
"How do you structure a large Python codebase for maintainability?",
"Explain the differences between a list, tuple, and set. When do you reach for each?"],
"java": ["Explain Java's inheritance model. How do you handle polymorphism in practice?",
"How would you make a concurrent Java application thread-safe?"],
"javascript":["How does the JavaScript event loop work?",
"Explain closures. When would you use one?"],
"sql": ["Explain the differences between INNER, LEFT, and FULL OUTER joins.",
"How do you optimize a slow query? Walk me through your process."],
"react": ["How does React handle re-rendering? How do you keep performance sane at scale?",
"Explain hooks and the rules of hooks."],
"aws": ["Walk me through how you would design a highly available service on AWS.",
"How do you manage costs and multi-account strategy in AWS?"],
"docker": ["Explain how Docker images, containers, and volumes relate.",
"How would you build a reproducible deployment pipeline with Docker?"],
"project management":["How do you prioritize when stakeholders have competing demands?",
"Tell me about a time a project was off track. What did you do?"],
"leadership": ["Give an example of a time you influenced a team without formal authority.",
"How do you handle an underperforming team member?"],
"sales": ["Walk me through your process for closing a difficult deal.",
"Tell me about a time you lost a deal. What would you change?"],
}
BEHAVIORAL = [
"Tell me about a time you faced a significant challenge at work. How did you handle it?",
"Describe a conflict with a coworker. How did you resolve it?",
"Give an example of a goal you met or missed, and what you learned.",
"How do you prioritize your tasks on a busy day?",
"Tell me about a time you made a mistake. What happened, and what changed?",
"Describe a situation where you had to make a quick decision with incomplete information.",
"Give an example of how you trained or mentored someone.",
"Tell me about a time you succeeded despite having minimal resources.",
]
CLARIFY = [
"What did you mean by that? Can you give a concrete example?",
"What was your specific role in that situation?",
"How did you measure the outcome? What were the numbers?",
"What would you do differently in hindsight?",
"Can you walk me through the decision process step by step?",
]
def detect_skills(text):
low = text.lower()
found = []
for skill, _ in SKILL_MAP.items():
if skill in low:
found.append(skill)
# generic tech markers
if not found:
for marker in ["software", "engineer", "developer", "devops", "data", "product", "design", "manager", "analyst"]:
if marker in low:
found.append("general")
break
return found if found else ["general"]
def build_questions(td):
import random
import re
role = re.sub(r'\s+', ' ', td.strip())
skills = detect_skills(role)
tech = []
for s in skills:
if s == "general":
tech += ["Walk me through your most complex technical project. What were the tradeoffs?",
"How do you debug a system that's failing in production but works locally?"]
else:
tech += SKILL_MAP[s]
random.seed(len(td)) # deterministic per input
behav = random.sample(BEHAVIORAL, k=min(3, len(BEHAVIORAL)))
clarify = random.sample(CLARIFY, k=2)
lines = []
lines.append("🎯 TAILORED INTERVIEW QUESTION SET")
lines.append("")
lines.append(f"Detected focus areas: {', '.join(skills).upper()}")
lines.append("")
lines.append("— TECHNICAL / ROLE-SPECIFIC —")
for i, q in enumerate(tech[:6], 1):
lines.append(f"{i}. {q}")
lines.append("")
lines.append("— BEHAVIORAL (STAR) —")
for i, q in enumerate(behav, 1):
lines.append(f"{i}. {q}")
lines.append("")
lines.append("— FOLLOW-UP / CLARIFYING —")
for q in clarify:
lines.append(f"• {q}")
lines.append("")
lines.append("💡 STAR method: Situation → Task → Action → Result. Aim for 2-minute answers.")
return "\n".join(lines)
def _process_core(input_data):
return build_questions(input_data)
# ─── ROUTES: Core Feature (customize this!) ───────────────
@app.route('/process', methods=['POST'])
@login_required
def process():
input_data = request.form.get('input_data', '')
result = _process_core(input_data)
db = get_db()
db.execute("INSERT INTO results (user_id,data) VALUES (?,?)", (session['user_id'], result))
db.commit()
db.close()
tweet_text = f"I just used {APP_NAME} — {TAGLINE} Check it out!"
tweet_url = f"https://twitter.com/intent/tweet?text={urllib.parse.quote(tweet_text)}"
content = f"""
"""
return BASE_LAYOUT.replace("{{STYLE}}", BASE_STYLE).replace("{{APP_NAME}}", APP_NAME).replace("{{TAGLINE}}", TAGLINE).replace("{{ACCENT_COLOR}}", ACCENT_COLOR).replace("{{PRIMARY_COLOR}}", PRIMARY_COLOR).replace("{{page_title}}", "Result").replace("{{CONTENT}}", content).replace("{{BMAC_FOOTER}}", BMAC_FOOTER).replace("{{year}}", str(datetime.now().year))
# ─── ROUTES: SEO & Health ─────────────────────────────────
@app.route('/health')
def health():
return jsonify({"status": "ok", "app": APP_NAME, "slug": APP_SLUG, "version": "1.0.0"})
@app.route('/sitemap.xml')
def sitemap():
base = request.host_url.rstrip('/')
urls = ['/', '/pricing', '/register', '/login']
xml = '\n\n'
for u in urls:
xml += f' {base}{u}\n'
xml += ''
response = make_response(xml)
response.headers['Content-Type'] = 'application/xml'
return response
@app.route('/about')
def about():
content = f"""
About {APP_NAME}
{TAGLINE}
Built with Flask, SQLite, and BTCPay Server for Bitcoin payments. Deployed on Proxmox infrastructure. Part of the Daily App Factory — one new app every day.